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.
- Introduction to the Data
- Preparing Our Function
- The map Function
- Creating New Columns with map
- Two Input Variation of map
- Two Input Variation of map (part 2)
- Even More map Variations
- Lists as Inputs
- Vectorizing Summaries
- Next Steps