Site icon R-bloggers

Apply-style commands in R

[This article was first published on The Data Monkey, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.

To leave a comment for the author, please follow the link and comment on their blog: The Data Monkey.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.