As you can read in the help file of the ashina
data set (see help(ashina)
), the variable grp
indicates whether the placebo was given first or the active treatment was given first. In the long format ashina_long
the measurements for placebo first and for active treatment first are arranged underneath each other, so it may be handy to have a variable period
indicating when a particular observation (row) was done. Add this variable period
to the ashina_long
data frame (its possible values are either 1 or 2).
ashina_long grp treat vas id 1 1 active -167 1 2 1 active -127 2 3 1 active -58 3 4 1 active -103 4 5 1 active -35 5 6 1 active -164 6 7 1 active -3 7 8 1 active 25 8 9 1 active -61 9 10 1 active -45 10 11 2 active -38 11 12 2 active 29 12 13 2 active 2 13 14 2 active -18 14 15 2 active -74 15 16 2 active -72 16 17 1 plac -102 1 18 1 plac -39 2 19 1 plac 32 3 20 1 plac 28 4 21 1 plac 16 5 22 1 plac -42 6 23 1 plac -27 7 24 1 plac -30 8 25 1 plac -47 9 26 1 plac 8 10 27 2 plac 12 11 28 2 plac 11 12 29 2 plac -9 13 30 2 plac -1 14 31 2 plac 3 15 32 2 plac -36 16
(from: Dalgaard, 2008, Introductory Statistics with R, Springer)