Intermediate Functional Programming with purrr
Continue learning with purrr to create robust, clean, and easy to maintain iterative code.
Commencer Le Cours Gratuitement4 heures17 vidéos49 exercices5 363 apprenantsDéclaration de réalisation
Créez votre compte gratuit
ou
En continuant, vous acceptez nos Conditions d'utilisation, notre Politique de confidentialité et le fait que vos données sont stockées aux États-Unis.Formation de 2 personnes ou plus ?
Essayer DataCamp for BusinessApprécié par les apprenants de milliers d'entreprises
Description du cours
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.
Formation de 2 personnes ou plus ?
Donnez à votre équipe l’accès à la plateforme DataCamp complète, y compris toutes les fonctionnalités.Dans les titres suivants
Boîte à outils Tidyverse intermédiaire
Aller à la piste- 1
Programming with purrr
GratuitDo 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.
purrr basics - a refresher50 xpRefreshing your purrr memory100 xpAnother purrr refresher100 xpIntroduction to mappers50 xpCreating lambda functions100 xpLambda functions100 xpUsing mappers to clean up your data50 xpClean up your data with keep100 xpSplit up with keep() and discard()100 xpPredicates50 xpWhat is a predicate?50 xpExploring data with predicates100 xp - 2
Functional programming: from theory to practice
Ready to go deeper with functional programming and purrr? In this chapter, we'll discover the concept of functional programming, explore error handling using including safely() and possibly(), and introduce the function compact() for cleaning your code.
Functional programming in R50 xpEverything that happens is a function call50 xpIdentifying pure functions100 xpTools for functional programming in purrr50 xpSafe iterations100 xpCreate a function100 xpUsing possibly()50 xpA possibly() version of read_lines()100 xpEverything in one call100 xpHandling adverb results50 xpPurrrfecting our function100 xpExtracting status codes with GET()100 xp - 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.
Why cleaner code?50 xpHow to write compose()50 xpBack to the office100 xpBuilding functions with compose() and negate()50 xpBuild a function100 xpCount the NA100 xpPrefilling functions50 xpA content extractor100 xpAnother extractor100 xpList columns50 xpAbout list-columns50 xpCreate a list-column data.frame100 xp - 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.
Discovering the dataset50 xpPlaying with tweets, round 1100 xpIdentify profiles100 xpExtracting information from the dataset50 xpCounting favorites100 xpExtracting mentions100 xpManipulating URLs50 xpAnalyzing URLs100 xpPlaying with URLs100 xpIdentifying influencers50 xpSplitting the dataset100 xpWe have a winner!100 xpCongratulations!50 xp
Formation de 2 personnes ou plus ?
Donnez à votre équipe l’accès à la plateforme DataCamp complète, y compris toutes les fonctionnalités.Dans les titres suivants
Boîte à outils Tidyverse intermédiaire
Aller à la pistecollaborateurs
Qu’est-ce que les autres apprenants ont à dire ?
Inscrivez-vous 15 millions d’apprenants et commencer Intermediate Functional Programming with purrr Aujourd’hui!
Créez votre compte gratuit
ou
En continuant, vous acceptez nos Conditions d'utilisation, notre Politique de confidentialité et le fait que vos données sont stockées aux États-Unis.