unlistMap {easy.utils} | R Documentation |
Unlist a mapping list into a named vector
Description
Function to unlist a one-to-one or one-to-many 'key-value' list
into
a named vector
. Useful for batched replacement of vector elements.
Usage
unlistMap(map, keep.unique = TRUE)
Arguments
map |
A named list. Each element must be a vector. |
keep.unique |
Whether or not to remove elements with duplicated names from the output vector. |
Value
A named vector whose names are original values in map
, and elements
are keys of map
Examples
map <- list(X = c("a", "b"), Y = c("c", "d"))
unlistMap(map)
map <- list(X = c("a", "b", "c"), Y = c("c", "d"))
unlistMap(map)
unlistMap(map, keep.unique = FALSE)
[Package easy.utils version 0.0.4 Index]