data(weightloss)
head(weightloss)
# Three-way repeated measures ANOVA (diet x exercises x time), all within
weightloss_long <- reshape(weightloss, varying = c("t1", "t2", "t3"),
v.names = "score", timevar = "time",
idvar = c("id", "diet", "exercises"),
direction = "long")
summary(aov(score ~ diet * exercises * factor(time) +
Error(factor(id)/(diet * exercises * factor(time))),
data = weightloss_long))
Run the code above in your browser using DataLab