The Map Function in R

In this lesson of our course on strings, dates and times in R, we'll learn the fundamentals of working with the map function in R.

Specifically, we'll learn how to vectorize a function. As we know them, functions take inputs, perform a calculation on them and then return an output. Currently, we have no way of taking each of the values in a tibble column and putting them through a function to get a column of outputs.

Unfortunately, this process is more complicated than passing in a single column into a function and getting back an output column. This operation is extremely common in data analysis, but it requires more explanation and depth compared to what we covered so far.

This mission will combine the concepts of vectorization and custom functions, and there's a lot of ground to cover. Learning this skill will greatly expand your capabilities as a programmer and analyst.


  • Learn about the map function in R.
  • Understand how you can vectorize custom functions.
  • Learn to use lists as inputs.

Mission Outline

  1. Introduction
  2. Introduction to the Data
  3. Preparing Our Function
  4. The map Function
  5. Creating New Columns with map
  6. Two Input Variation of map
  7. Two Input Variation of map (part 2)
  8. Even More map Variations
  9. Lists as Inputs
  10. Vectorizing Summaries
  11. Next Steps

Course Info:


This course requires a Basic subscription and includes three missions and one guided project.  It is the fourth course in the Data Analyst in R learning path.


Take a Look Inside