Dear all
I obtain different results depending on whether I use aggregate with or without the formula option for a small dataframe that have NA in the variables to be aggregated
here is the example :
k=data.frame(genotype=rep("CC91",3),Pb=c(0.206,0.393,NA),Sod=c(0.0214,NA,0.0576))
m1=aggregate(.~genotype,FUN=function(z) mean(z,na.rm=T),data=k)
m2=aggregate(x=k[,-1],by=list(k$genotype),FUN=function(z) mean(z,na.rm=T))
m1
m2
m1 genotype Pb Sod CC91 0.206 0.0214
m2 Group.1 Pb Sod CC91 0.2995 0.0395
Any ideas? Thank you in advances,
Chris