Congratulations!
1. Congratulations!
Congratulations! You've completed this course on programming with purrr. Let's quickly review what we've seen in this course.2. Function creation
In this course, we have seen how we can use purrr to create functions easily. In purrr terminology, these functions are called mappers — they are functions written as one-sided formulas, and describe what happens to each element of the list you are iterating on. If you need to save these mappers, you can always call the as_mapper() function, which creates a reusable mapper from a lambda function.3. Function manipulation
Once you have created these functions, you can use them with two kinds of functions we have seen in this course. Functionals are functions that take a function as input and return a vector. This is what all the map() functions do: they take a list and a function and apply this function on each element of the list. keep() and discard() are also from this family, as are some() and every(). Function operators, on the other hand, take a function and return another function, modified. This is what safely(), possibly(), partial(), compose() and negate() do.4. Cleaner code
In this course, we've seen how we can use purrr to write cleaner code. Cleaner code means that it's easier to read, easier to understand, and easier to maintain. Here, for example, we want to compute a rounded mean of each column of two dataframes. We can do it by combining partial() and compose(), and two variations of map(). As you can see, this code is straightforward to understand and will be easy to maintain.5. Where to go next?
What to do now? First, you should try using purrr with real-life projects, or in your own package. Then, to discover more about other tidyverse packages, browse the Datacamp course library to discover other courses that can help you. If you're interested in functional programming, Advanced R has a great chapter about this topic. And finally, feel free to continue to explore purrr: there are a lot of functions we haven't covered in this course, and they are just waiting for you to try them!6. See you soon!
Thanks a lot for taking this course. See you soon in the wonderful world of purrr!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.