Thursday, March 14, 2013

Apply-style commands in R

Here's a quick table of what I think are the most useful apply-style commands in R:
FunctionInputOutputBest for
applyRectangularRectangular or vectorApplying function to rows or columns
lapplyAnythingListNon-trivial operations on almost any data type
sapplyAnythingSimplified (if possible) or listSame as lapply, but with simplified output
plyr::ddplydata.framedata.frameApplying function to groupings defined by variables
For alternatives to plyr, see this post on StackOverflow.