A common analytical pattern is to split data into pieces, apply some function to each piece, and then combine the results back together. The plyr package provides simple functions to apply this pattern, while simplifying the specification of the object types through systematic naming of the functions.
The plyr function name has three parts, XYply, where X specifies what sort of input you're giving , Y specifies the sort of output you want and ply part is common to all function names. X and Y represent one of the following options:
- a = array
- d = data.frame
- l = list
- _ = no output; only valid for Y; for example, useful when you're operating
on a list purely for the side effects, making a plot, or sending output to screen/file
ddply has its input and output as data frames, and ldply takes a
list as input and produces a data...