SUM,COUNT,AVG
Jun Shen:
I mainly have data frames. summarize() does not seem to work with multiple columns from a data frame. Any suggestion? Thanks.
summarize() *does* work with multiple columns from data frames, but the function you use must be able to do column-wise calculations. Example: with(iris, summarize(iris[1:4], Species, colSums, stat.name=NULL)) If there weren?t a ?colSums? function, you could easily accomplish the same thing by using apply on the ?sum? function: with(iris, summarize(iris[1:4], Species, function(x) apply(x,2,sum), stat.name=NULL))
Karl Ove Hufthammer