I have a data which I am working on it. I need to run repeated measures Anova
test on it but first I have to reshape data to long format. I did something as shown on website, reshaping doesn't give any error but I don't think it works. So Anova
test gives error. Here is my code and error.
# reshaping to long format
id=1:length(veri$SIRA)
k.1 <- veri$KOLEST
k.2 <- veri$KOLEST2
k.3 <- veri$KOLEST3
veri2 <- data.frame(id,k.1,k.2,k.3)
longformat <- reshape(veri2,direction="long", varying=list("k.1","k.2","k.3"), idvar="id")
This is output for longformat
id time k.1 k.2 k.3
1 1 1 209 195 181
2 2 1 243 184 172
3 3 1 192 178 162
4 4 1 210 112 93
5 5 1 190 188 172
6 6 1 232 169 156
Time is 1 all along. This seems little odd to me. I thought it shoud be 1-2-3 according to 3 different measures.
And this is error when I run the test:
repmesao <- aov(k~time+Error(id/time), data=longformat)
Error in model.frame.default(formula = k ~ id/time, data = longformat, :
invalid type (list) for variable 'k'
How I can fix this problem? Any suggestions?