Seems like a basic question and perhaps I\'m just missing something obvious ... but is there any way to pluck
a sublist (with purrr
)?
More specifically
There's clearly a need for "muti-value pluck". It really comes down to extending flexibility of "pluck" to retrieving multiple values from the same level of list, as described in this github issue. For the example above, you can probably get away with:
> purrr::map(purrr::set_names(c("a", "b")),
~purrr::pluck(l, .x, .default = NA_character_))
#> $a
#> [1] "foo"
#>
#> $b
#> [1] "bar"