I would recommend plyr look at the plyr package. It may not be as fast as data.table or other packages, but it is very instructive, especially when starting with R and having to do some data manipulation.
> DF <- data.frame(A = c("1", "1", "2", "3", "3"), B = c(2, 3, 3, 5, 6)) > library(plyr) > DF.sum <- ddply(DF, c("A"), summarize, B = sum(B)) > DF.sum AB 1 1 5 2 2 3 3 3 11
r0bert Sep 14 '13 at 9:38 on 2013-09-14 09:38
source share