Part A(1 & 2)
library(plyr)
mydata3<-ddply(mydata1,.(Time),summarize,mean=mean(NP.T),sd=sd(NP.T),nobs=length(unique(ID)))
> mydata3
Time mean sd nobs
1 1 2.0 0.0000000 2
2 2 1.5 0.5773503 2
3 3 1.0 0.0000000 2
Part B:
myaov <- aov(mean ~ Time, data=mydata3)
> myaov
Call:
aov(formula = mean ~ Time, data = mydata3)
Terms:
Time Residuals
Sum of Squares 0.5 0.0
Deg. of Freedom 1 1
Residual standard error: 1.17148e-16
Estimated effects may be unbalanced
Uodated: For the error Error in is.list(by) : 'by' is missing
, please check here for details. As mentioned in the website, this problem is not a problem of RStudio, but a problem of the Hmisc library masking the function summarize
from the package 'plyr'.
So, you need to add library(Hmisc)
in the earlier code.
library(plyr)
library(Hmisc)
mydata3<-ddply(mydata1,.(Time),summarize,mean=mean(NP.T),sd=sd(NP.T),nobs=length(unique(ID)))