This concludes this book on functional programming in R. You now know all the basic programming patterns used in day-to-day functional programming and how to use them in the R programming language.

Getting used to writing functional programs might take a little effort if you are only used to imperative or object-oriented programming, but the combination of higher-order functions and closures is a very powerful paradigm for effective programming, and writing pure functions whenever possible makes for code that is much simpler to reason with.

R is not a pure functional programming language, though, so your code will usually mix imperative programming—which in most cases means using loops instead of recursions, both for convenience and efficiency ...

Get Functional Programming in R: Advanced Statistical Programming for Data Science, Analysis and Finance now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.