I wanted to sum individual columns by group and my first thought was to use tapply.
However, I cannot get tapply to work. Can tapply
tapply works on a vector, for a data.frame you can use by (which is a wrapper for tapply, take a look at the code):
> by(df.1[,c(3:5)], df.1$state, FUN=colSums)
df.1$state: AA
apples cherries plums
111 222 333
-------------------------------------------------------------------------------------
df.1$state: BB
apples cherries plums
-111 -222 -333