Hi,
Try:
Gene[,-1] <- lapply(Gene[,-1],function(x) {x[sample(length(x),1)] <- NA;x})
A.K.
I got it guys
MeanofGenotype <-sapply(2:8, function(k) tapply(Gene[,k] , Gene$Genotype,
mean))
I was wondering if now you guys can help me on how to insert a random NA to
each column.
The question i
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)
2 matches
Mail list logo