Summary data tables from wide data.frames
I am trying to find lazy/easy ways of creating summary tables/ data.frames from wide data.frames . Assume a following data.frame, but with many more columns so that specifying the column names takes a long time: set.seed(2) x <- data.frame(Rep = rep(1:3, 4), Temp = c(rep(10,6), rep(20,6)), pH = rep(c(rep(8.1, 3), rep(7.6, 3)), 2), Var1 = rnorm(12, 5,2), Var2 = c(rnorm(6,4,1), rnorm(6,3,5)), Var3 = rt(12, 20)) x[1:3] <- as.data.frame(apply(x[1:3], 2, function(x) as.factor(x))) Now I can calculate summary statistics with plyr : (mu <- ddply(x, .(Temp, pH), numcolwise(mean))) (std <- ddply(x, .