I have a simple dataframe, and want to aggregate on both mean and count of each.
I have three steps:
aggregate(x$value1,list(x$col1),mean)
aggregate(x$value1,list(x$col1),nrow)
merge(d1,d2,by='Group.1')
colnames(m)=c('col1','mean','count')
I am sure there is a more efficient way to do this in R.
Any suggestions?