Skip to contents

The map functions transform their input by applying a function to each element of a list or atomic vector and returning an object of the same length as the input.

  • map() always returns a list. See the modify() family for versions that return an object of the same type as the input.

  • map_lgl(), map_int(), map_dbl() and map_chr() return an atomic vector of the indicated type (or die trying). For these functions, .f must return a length-1 vector of the appropriate type.

  • map_vec() simplifies to the common type of the output. It works with most types of simple vectors like Date, POSIXct, factors, etc.

  • walk() calls .f for its side-effect and returns the input .x.

Usage

map_struct(.x, .f, ..., .progress = FALSE)

Arguments

.x

a `struct_list`

.f

a function to apply to each structure

...

additional parameters to `.f` but anonymous function preferred

.progress

display a progress bar (logical or string name)

Value

a `struct_list`

See also

[purrr::map()]