Displaying 1 result from an estimated 1 matches for "formcl".
Did you mean:
formal
2010 Nov 29
3
data.frame and formula classes of aggregate
...;- data.frame(sex=rep(0:1,each=3),
wt=c(100,110,120,200,210,NA),ht=c(10,20,NA,30,40,50)))
x1<- aggregate(d, by = list(d$sex), FUN = mean);
names(x1)[3:4]<- c('mean.dfcl.wt','mean.dfcl.ht')
x2<- aggregate(cbind(wt,ht)~sex,FUN=mean,data=d);
names(x2)[2:3]<- c('mean.formcl.wt','mean.formcl.ht')
cbind(x1,x2)[,c(2,3,6,4,7)]
The output from the data.frame class has an NA if there are missing values
in the group for the variable with missing values. But, the formula class
output seems to delete the entire row (missing and non-missing values) if
there are an...