Displaying 1 result from an estimated 1 matches for "meanofgenotype".
2013 Oct 14
1
R Help-how to use sapply w/tapply
Hi,
(Please use ?dput() to share the example dataset. Avoid using images to show dataset. Also, please read the posting guide esp. regarding home work, assignments etc.)
res <- sapply(Gene[,-1],function(x) tapply(x,list(Gene$Genotype),mean))
#or
res2 <-? aggregate(.~Genotype, data=Gene,mean)
#or
library(plyr)
?res3 <- ddply(Gene,.(Genotype),numcolwise(mean))
identical(res2,res3)