Work Smarter, Not Harder - Efficient and Elegant R Code

In this chapter, we will cover recipes for doing the following without explicit iteration:

  • Exploiting vectorized operations
  • Processing entire rows or columns using the apply function
  • Applying a function to all elements of a collection with lapply and sapply
  • Applying functions to subsets of a vector
  • Using the split-apply-combine strategy with plyr
  • Slicing, dicing, and combining data with data tables

Get R Data Analysis Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.