*apply in all its variations …

R
Author

Michael

Published

October 13, 2012

Here is an excellent stackoverflow post on how apply in all its variations can be used.
One of the followups points at plyr (from demi-R-god Hadley Wickham) which provides a consistent naming convention for all the
apply variations. I like plyr a lot, because like ggplot, it is easy to grasp and relatively intuitive to find an answer to even tricky problems.

Here is the translation from *apply to plyr …

Base function   Input   Output   plyr function 
---------------------------------------
aggregate        d       d       ddply + colwise 
apply            a       a/l     aaply / alply 
by               d       l       dlply 
lapply           l       l       llply  
mapply           a       a/l     maply / mlply 
replicate        r       a/l     raply / rlply 
sapply           l       a       laply