Share

TXT file of pro version with minimal Comments

#set this up for your data
fulldata <- emergenceAllday8again

fulldata$meanResponse <- fulldata$EMERGE7

meanfactors <- with(fulldata, list(NLEVEK,DEPTH))

namesMean <- c("Nlevel","Depth","mean")

############run this#######################

fulldata <- na.omit(fulldata)
meanGeneric <- with(fulldata, aggregate(meanResponse, meanfactors, mean))
reps1 <- with(fulldata, aggregate(meanResponse, meanfactors, length))
names(meanGeneric) <- namesMean
meanGeneric$sd <- with(fulldata, aggregate(meanResponse, meanfactors, sd))$x
meanGeneric$se <- meanGeneric$sd/sqrt(reps1$x)

##end

##By Larry York, 2-19-2012, available at http://roots.psu.edu/en/rootstats/meansanderror