Kom igångKom igång gratis

map_chr()

In this exercise, you'll dive a bit deeper into the different map_*() variants. The map() function always outputs a list. map_*() outputs other kinds of information. Study the table below and make sure you're clear on the type of output for each map_*() variant.

map_*() Output
map_chr() character vector
map_lgl() logical vector [TRUE or FALSE]
map_int() integer vector
map_dbl() double vector

Den här övningen är en del av kursen

Foundations of Functional Programming with purrr

Visa kurs

Interaktiv övning med praktiskt arbete

Testa den här övningen genom att slutföra den här exempelkoden.

# Pull out the director element of sw_films in a list and character vector
map(___, ~.x[["___"]])
map_chr(___, ~.x[["___"]])
Redigera och kör kod