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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.