The R programming language, being procedural, provides looping control structures. Most people, therefore, tend to automatically use these control structures in their own code and end up with performance issues, as R handles loops very inefficiently. Serious number crunching and handling large datasets in R require us to exploit powerful, alternative ways to write succinct, elegant, and efficient code, as follows:
- Vectorized operations process collections as a whole, instead of operating element by element
- The apply family of functions processes rows, columns, or lists as a whole, without the need for explicit iteration
- The plyr package provides a wide range of **ply functions with additional functionalities, including parallel processing
- The data.table package provides helpful functions to manipulate data easily and efficiently
This chapter provides recipes using...