This is a review of Hadley and Charlotte Wickham’s DataCamp course entitled Writing Functions in R.

Wickham and Wickham (borther and sister) do a great job of introducing some of the concepts of functional programming in R. The first chapter is a refresher on some of the basic program structures in R. From there, they get into building functions including rules around functions, how parameters are interpreted, and good tips for naming functions.

Chapter 3 is the money chapter for me: it introduces some of the key functional programming constructs in R, particularly in the purrr package. Higher-order functions and lambda expressions can be a bit complex to explain, but Charlotte does a fantastic job of it.

One area where I learned a lot was in chapters 4 and 5, dealing with writing safe functions. I haven’t been that good about writing robust R code, so learning about stopifnot, safely, and the like was enlightening.

This is a really good course. The course progresses well enough that you hardly notice how far along you’re getting—it’s a smooth learning curve and I don’t remember once having to stop while working on an exercise, look things up, and read up on a bunch of stuff not covered in the course. To me, that’s the sign of a successful DataCamp course.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s