© Thomas Mailund 2022
T. MailundBeginning Data Science in R 4https://doi.org/10.1007/978-1-4842-8155-0_11

11. Functional Programming

Thomas Mailund1  
(1)
Aarhus, Denmark
 

In this chapter, we explore the programming paradigm called functional programming and how it relates to R. There are many definitions of what it means for a language to be a functional programming language, and there have been many language wars over whether any given feature is “pure” or not. I won’t go into such discussions, but some features, I think everyone would agree, are needed. You should be able to define higher-order functions, you should be able to create closures, and you probably want anonymous functions as well.

Let’s tackle anonymous functions right away, as these ...

Get Beginning Data Science in R 4: Data Analysis, Visualization, and Modelling for the Data Scientist 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.