Aan de slagGa gratis aan de slag

map_dbl() and map_int()

Some flavors of map_*() are very similar. map_dbl() and map_int() both output numbers. map_int() outputs integer vectors, which have numbers with no decimals. map_dbl() outputs double vectors, which have numbers that can have decimals. Take a closer look at how using different map_*() functions affect outputs.

Here is the map_*() table again as a reference.

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

Deze oefening maakt deel uit van de cursus

Foundations of Functional Programming with purrr

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Pull out episode_id element as list
map(___, ~.x[["___"]])

# Pull out episode_id element as double vector
map____(___, ~.x[["___"]])
Code bewerken en uitvoeren