The "apply" family of functions in R (apply, sapply, lapply) is a very powerful suite of tools for iterating through structures of data and returning the combined results of each iteration. But with great power comes great responsibility (or something like that): these functions can sometimes be frustratingly difficult to get working exactly as you intended, especially for newcomers to R.
That’s where the functions from Hadley Wickham’s plyr package come in: they create a unified interface for iterating over data in R with a consistent syntax for specifying what the inputs are, and what the outputs should be.
JD Long captures both the frustration that come with mis-applying apply and the joy of overcoming it with plyr in this 5-minute video. Be sure to check the associated blog post for the background and comments.
Cerebral Mastication: Struggling with apply() in R