Skip to main content
HomeR

Course

Intermediate Functional Programming with purrr

IntermediateSkill Level
4.8+
31 reviews
Updated 11/2024
Continue learning with purrr to create robust, clean, and easy to maintain iterative code.
Start Course for Free
RProgramming4 hr17 videos49 Exercises3,850 XP5,633Statement of Accomplishment

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies

Group

Training 2 or more people?

Try DataCamp for Business

Course Description

Have you ever been wondering what the purrr description (“A functional programming toolkit for R”) refers to? Then, you’ve come to the right place! This course will walk you through the functional programming part of purrr - in other words, you will learn how to take full advantage of the flexibility offered by the .f in map(.x, .f) to iterate other lists, vectors and data.frame with a robust, clean, and easy to maintain code. During this course, you will learn how to write your own mappers (or lambda functions), and how to use predicates and adverbs. Finally, this new knowledge will be applied to a use case, so that you’ll be able to see how you can use this newly acquired knowledge on a concrete example of a simple nested list, how to extract, keep or discard elements, how to compose functions to manipulate and parse results from this list, how to integrate purrr workflow inside other functions, how to avoid copy and pasting with purrr functional tools.

Prerequisites

Foundations of Functional Programming with purrr
1

Programming with purrr

Do lambda functions, mappers, and predicates sound scary to you? Fear no more! After refreshing your purrr memory, we will dive into functional programming 101, discover anonymous functions and predicates, and see how we can use them to clean and explore data.
Start Chapter
2

Functional programming: from theory to practice

3

Better code with purrr

In this chapter, we'll use purrr to write code that is clearer, cleaner, and easier to maintain. We'll learn how to write clean functions with compose() and negate(). We'll also use partial() to compose functions by "prefilling" arguments from existing functions. Lastly, we'll introduce list-columns, which are a convenient data structure that helps us write clean code using the Tidyverse.
Start Chapter
4

Case study

We'll wrap up everything we know about purrr in a case study. Here, we'll use purrr to analyze data that has been scraped from Twitter. We'll use clean code to organize the data and then we'll identify Twitter influencers from the 2018 RStudio conference.
Start Chapter
Intermediate Functional Programming with purrr
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.8
from 31 reviews
81%
19%
0%
0%
0%
  • Zlatko
    2 weeks ago

  • Emese
    6 weeks ago

  • Tung
    last month

    .

  • Stanislau
    2 months ago

  • João Pedro
    2 months ago

  • WenHuang
    2 months ago

Zlatko

Emese

Stanislau

FAQs

What does functional programming with purrr actually mean in practice?

It means using lambda functions, predicates, and adverbs from purrr to iterate over lists, vectors, and data frames with cleaner, more maintainable code than traditional loops.

What are safely, possibly, compose, and partial used for in purrr?

The safely and possibly functions handle errors gracefully during iteration. The compose and partial functions help you build new functions by combining or prefilling arguments of existing ones.

What dataset is used in the case study chapter?

The case study analyzes data scraped from Twitter about the 2018 RStudio conference. You use purrr to organize the data and identify Twitter influencers from the event.

Should I complete Foundations of Functional Programming with purrr first?

Yes, that course is a prerequisite. This intermediate course assumes you already know how to use map functions and basic purrr workflows.

Does this course introduce list-columns as a data structure?

Yes, Chapter 3 introduces list-columns as a convenient data structure for writing clean code within the tidyverse, combining them with purrr functional tools.

Join over 19 million learners and start Intermediate Functional Programming with purrr today!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.