R Language Study - wz58/R GitHub Wiki

Map family of functions

map_chr() library(purrr)

map_chr(c(5, 4, 3, 2, 1), function(x){ c("one", "two", "three", "four", "five")[x] }) [1] "five" "four" "three" "two" "one"

map_lgl(c(1, 2, 3, 4, 5), function(x){ x > 3 }) [1] FALSE FALSE FALSE TRUE TRUE

map_lgl()


map_dbl()