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 |
Diese Übung ist Teil des Kurses
Foundations of Functional Programming with purrr
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Pull out the director element of sw_films in a list and character vector
map(___, ~.x[["___"]])
map_chr(___, ~.x[["___"]])