map-like functions, similar to the ones implemented in purrr:

  • map() returns the results of .f applied to .x as list. If .f is not a function, map will call [[ on all elements of .x using the value of .f as index.

  • imap() applies .f to each value of .x (passed as first argument) and its name (passed as second argument). If .x does not have names, a sequence along .x is passed as second argument instead.

  • pmap() expects .x to be a list of vectors of equal length, and then applies .f to the first element of each vector of .x, then the second element of .x, and so on.

  • map_if() applies .f to each element of .x where the predicate .p evaluates to TRUE.

  • map_at() applies .f to each element of .x referenced by .at. All other elements remain unchanged.

  • keep() keeps those elements of .x where predicate .p evaluates to TRUE.

  • discard() discards those elements of .x where predicate .p evaluates to TRUE.

  • every() is TRUE if predicate .p evaluates to TRUE for each .x.

  • some() is TRUE if predicate .p evaluates to TRUE for at least one .x.

Additionally, the functions map(), imap() and pmap have type-safe variants with the following suffixes:

map(.x, .f, ...)

map_lgl(.x, .f, ...)

map_int(.x, .f, ...)

map_dbl(.x, .f, ...)

map_chr(.x, .f, ...)

map_dtr(.x, .f, ..., .fill = FALSE)

map_dtc(.x, .f, ...)

pmap(.x, .f, ...)

pmap_lgl(.x, .f, ...)

pmap_int(.x, .f, ...)

pmap_dbl(.x, .f, ...)

pmap_chr(.x, .f, ...)

pmap_dtr(.x, .f, ..., .fill = FALSE)

pmap_dtc(.x, .f, ...)

imap(.x, .f, ...)

imap_lgl(.x, .f, ...)

imap_int(.x, .f, ...)

imap_dbl(.x, .f, ...)

imap_chr(.x, .f, ...)

imap_dtr(.x, .f, ..., .fill = FALSE)

imap_dtc(.x, .f, ...)

keep(.x, .f, ...)

discard(.x, .p, ...)

map_if(.x, .p, .f, ...)

map_at(.x, .at, .f, ...)

every(.x, .p, ...)

some(.x, .p, ...)



:: (list() or atomic vector).


:: (function | character() | integer())
Function to apply, or element to extract by name (if .f is character()) or position (if .f is integer()).


:: any
Additional arguments passed down to .f or .p.


:: logical(1)
Passed down to data.table::rbindlist().


:: (function() | logical())
Predicate function.


:: (character() | integer() | logical())
Index vector.