Function | Input | Output | Best for |
apply | Rectangular | Rectangular or vector | Applying function to rows or columns |
lapply | Anything | List | Non-trivial operations on almost any data type |
sapply | Anything | Simplified (if possible) or list | Same as lapply, but with simplified output |
plyr::ddply | data.frame | data.frame | Applying function to groupings defined by variables |
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:
For alternatives to plyr, see this post on StackOverflow.
Subscribe to:
Posts (Atom)