Skip to main content

Be a Problem Solver

Tag: R

Characteristics of Functional Programming – Examples in R

Between 2016 and 2018, most of my projects were heavily written in R. At its core, R has a strong emphasis on functional programming. For example, I enjoyed using packages like dplyr to seamlessly chain data cleaning and modeling steps. In R, everything operates as a function call—even for loops function under the hood as calls.

for (i in 1:10) {
  print(i)
}
# is same as 

`for`(i, 1:10, print(i))

In this post, I introduce the fundamental concepts of functional programming, using R code as illustrative examples.