Skip to content
Prev 314605 / 398502 Next

"By" function Frame Conversion (with Multiple Indices)

On Jan 3, 2013, at 9:00 PM, Ray DiGiacomo, Jr. wrote:

            
I named the dataframe "dat"

aggregate( dat[,c("weight", "height")],
              list( age=dat$age, gender=dat$gender), FUN=mean,  
na.rm=TRUE)
   age gender weight height
1  12            98     66
2   5      f     40     40
3   6      f     42    NaN
4  13      f    100     67
5  22      m    180     72
6  50      m    255     60