Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use ddply() from the
plyr package with the summarise() function, and specify the operations to do:
library(MASS)# For the data setlibrary(plyr)ddply(cabbages,c("Cult","Date"),summarise,Weight=mean(HeadWt),VitC=mean(VitC))Cult Date Weight VitC c39 d163.1850.3c39 d202.8049.4c39 d212.7454.8c52 d162.2662.5c52 d203.1158.9c52 d211.4771.8