### Split, Apply, Combine: Using Base R (Introduction to Statistical Computing)

Lecture
12: Design patterns and their benefits: clarity on what is to be done,
flexibility about how to do it, ease of adapting others' solutions. The
split/apply/combine pattern: divide big structured data sets up into smaller,
related parts; apply the same analysis to each part independently; combine the
results of the analyses. Trivial example: `rowSums`, `colSums`.
Further examples. Iteration as a verbose, painful and clumsy implementation of
split/apply/combine. Tools for split/apply/combine in basic R:
the `apply` function for arrays, `lapply` for
lists, `mapply`, etc.; `split`. Detailed example with a
complicated data set: Masters 2011 Golf
Tournament. R, data.

Introduction to Statistical Computing

Posted at October 24, 2011 13:50 | permanent link