Skip to contents

This is an accessor function to the @treatments slot in a mediation data object. It returns the entire set of observed treatments, in contrast to treatments() applied to a multimedia object, which only returns the names of the treatment variables.

Usage

# S4 method for class 'mediation_data'
treatments(object)

Arguments

object

An object of class mediation_data.

Value

A data.frame whose rows are samples and columns different treatments.

Examples

exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
treatments(exper)
#>     treatment
#> 1     Control
#> 2   Treatment
#> 3     Control
#> 4   Treatment
#> 5     Control
#> 6   Treatment
#> 7     Control
#> 8     Control
#> 9     Control
#> 10  Treatment
#> 11  Treatment
#> 12  Treatment
#> 13  Treatment
#> 14    Control
#> 15    Control
#> 16    Control
#> 17  Treatment
#> 18    Control
#> 19  Treatment
#> 20    Control
#> 21    Control
#> 22  Treatment
#> 23    Control
#> 24    Control
#> 25  Treatment
#> 26  Treatment
#> 27  Treatment
#> 28    Control
#> 29  Treatment
#> 30    Control
#> 31  Treatment
#> 32    Control
#> 33    Control
#> 34  Treatment
#> 35    Control
#> 36    Control
#> 37  Treatment
#> 38  Treatment
#> 39  Treatment
#> 40  Treatment
#> 41  Treatment
#> 42    Control
#> 43  Treatment
#> 44    Control
#> 45  Treatment
#> 46    Control
#> 47    Control
#> 48    Control
#> 49  Treatment
#> 50  Treatment
#> 51  Treatment
#> 52  Treatment
#> 53  Treatment
#> 54    Control
#> 55    Control
#> 56  Treatment
#> 57    Control
#> 58    Control
#> 59    Control
#> 60  Treatment
#> 61  Treatment
#> 62    Control
#> 63  Treatment
#> 64  Treatment
#> 65  Treatment
#> 66  Treatment
#> 67    Control
#> 68  Treatment
#> 69    Control
#> 70  Treatment
#> 71  Treatment
#> 72    Control
#> 73    Control
#> 74  Treatment
#> 75    Control
#> 76  Treatment
#> 77  Treatment
#> 78    Control
#> 79  Treatment
#> 80    Control
#> 81    Control
#> 82    Control
#> 83    Control
#> 84    Control
#> 85    Control
#> 86    Control
#> 87    Control
#> 88  Treatment
#> 89    Control
#> 90    Control
#> 91  Treatment
#> 92  Treatment
#> 93  Treatment
#> 94  Treatment
#> 95    Control
#> 96  Treatment
#> 97    Control
#> 98    Control
#> 99    Control
#> 100 Treatment