Skip to content
Prev 315884 / 398506 Next

tapply and functions with more than one objects

On Jan 22, 2013, at 2:24 PM, Dominic Roye wrote:

            
You can use:

lapply(split( multi_col_object, category_vec) , function(x,y){sum(x,y)}  ) 

aggregate(dat, category, FUN=sum)

Or:

do.call(rbind, by( multi_col_object, category_vec, function(x,y){ ....} )

Sometimes `Reduce` is more compact. Other times `mapply` is needed.