LoslegenKostenlos starten

Names & pipe refresher

It is easy to determine if a list has names using names(). Understanding the named elements of a list can make working with the list elements easier because you can pull out the information you need by name, instead of searching for the correct numbered element.

purrr is a part of the tidyverse, a system of packages designed to be used together, and used with pipes. Let's do a quick refresh on how pipes work. A pipe %>% takes the output from the function that comes before it, and feeds it into the function that comes after the pipe as its first argument.

function_before() %>% 
    function_after()

You don't need to use pipes when you use purrr functions, but for the purposes of these lessons, you will be.

Diese Übung ist Teil des Kurses

<Kurs>Foundations of Functional Programming with purrr</Kurs>
Kurs ansehen

Übungsanweisungen

  • Check to see if the sw_films list has named elements with pipes.

Interaktive praktische Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Use pipes to check for names in sw_films
___ %>%
    ___()
Code bearbeiten und ausführen