Get startedGet started for free

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

This exercise is part of the course

Foundations of Functional Programming with purrr

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Pull out the director element of sw_films in a list and character vector
map(___, ~.x[["___"]])
map_chr(___, ~.x[["___"]])
Edit and Run Code