Skip to contents

This is an setter method for mediators in an S4 object, usually of class mediation_data.

Usage

mediators(object) <- value

Arguments

object

An object whose mediators slot to modify.

value

The new mediator values to set within object.

Value

Modifies the mediators slot of the input object in place.

Examples

exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
mediators(exper) <- data.frame(new_ASV = rnorm(100))
mediators(exper)
#>         new_ASV
#> 1   -0.59039574
#> 2    0.15874984
#> 3   -0.75193500
#> 4    0.18021168
#> 5   -0.26821059
#> 6    2.37578548
#> 7   -0.13173548
#> 8    0.45929127
#> 9    0.23376874
#> 10  -0.08224720
#> 11  -1.37690883
#> 12  -0.81491828
#> 13   0.88865503
#> 14  -0.67419372
#> 15  -0.15290731
#> 16   0.52153992
#> 17   0.80965913
#> 18   1.01160444
#> 19   1.60266174
#> 20   0.82419992
#> 21  -0.07367167
#> 22   0.94107181
#> 23   0.50598890
#> 24  -0.13049458
#> 25   0.13470550
#> 26   0.62651197
#> 27  -1.23616744
#> 28   0.97380862
#> 29   0.59905858
#> 30  -0.16550157
#> 31   0.29809992
#> 32  -0.67426206
#> 33  -1.56238313
#> 34  -1.06603874
#> 35   0.60850351
#> 36   0.21179540
#> 37   1.48568192
#> 38   1.01347152
#> 39   0.30108754
#> 40  -0.25163011
#> 41   0.88031503
#> 42  -1.22927953
#> 43   1.79682691
#> 44   0.15269592
#> 45   0.58486755
#> 46  -0.98757223
#> 47  -0.90294446
#> 48  -0.04760617
#> 49  -0.48933877
#> 50  -0.78956132
#> 51  -0.34326730
#> 52  -0.65215473
#> 53   0.71367904
#> 54   0.49190772
#> 55   0.81829330
#> 56  -1.23110960
#> 57   0.76995985
#> 58  -2.18762753
#> 59   1.27546646
#> 60  -2.52002414
#> 61  -0.61592989
#> 62   3.15606481
#> 63   0.02777858
#> 64   0.56918949
#> 65   1.27546840
#> 66   0.29469300
#> 67   0.86561372
#> 68  -1.21273330
#> 69  -2.33695037
#> 70  -0.18203803
#> 71  -1.10564777
#> 72   0.01564076
#> 73  -1.26974386
#> 74  -0.06726766
#> 75  -0.44292389
#> 76  -0.83930478
#> 77  -0.66614948
#> 78  -1.94606709
#> 79  -1.12093856
#> 80   1.35276036
#> 81   0.70577653
#> 82  -0.90589286
#> 83   0.78147918
#> 84  -0.21533112
#> 85   0.92662923
#> 86   0.93955178
#> 87   0.31486408
#> 88  -0.49886960
#> 89  -0.15048005
#> 90  -0.18969797
#> 91   2.64771817
#> 92  -1.12895152
#> 93   1.60857724
#> 94   0.44862095
#> 95  -0.44766044
#> 96  -0.73908931
#> 97  -1.31533014
#> 98   0.73149803
#> 99  -0.98946387
#> 100 -1.92534924