Using R to do regular data things

# SINGLE AGGREGATE
#sapply(abc[c("GrowthMindset", "SelfEfficacy", "MSelfEfficacy","MathAnxiety","TeacherUse")], mean)

#this just gets means
sapply(abc[c("GrowthMindset", "SelfEfficacy", "MSelfEfficacy","MathAnxiety","TeacherUse")], function(x) mean(x, na.rm=TRUE))

#this gives me a matrix of means
aggregate(cbind(GrowthMindset, SelfEfficacy, MSelfEfficacy) ~ treat, abc, function(x) mean(x, na.rm=TRUE))-> result1

#this gets me a full results
aggregate(cbind(GrowthMindset, SelfEfficacy, MSelfEfficacy, MathAnxiety,TeacherUse) ~ treat, abc,
function(x) c(sum=sum(x), mean=mean(x), min=min(x), q1=quantile(x)[2],
median=median(x), q3=quantile(x)[4], max=max(x), sd=sd(x)))

Leave a Reply