pak::pak("cran/purrr@1.0.0")
keep_at()
and discard_at()
purrr 1.1.0
purrr
purrr has two new functions, keep_at() and discard_at(), that operate on names.
Install purrr 1.0.0 with:
Load the package with:
keep_at()
and discard_at()
purrr has two functions, keep()
and discard()
, that keep/discard elements by value:
purrr has two new functions, keep_at()
and discard_at()
, that work like keep()
and discard()
but operate on names rather than values:
List of 3
$ a: num 1
$ b: num 2
$ c: num 3
x |>
discard_at(c("a", "b", "c")) |>
str()
List of 2
$ D: num 4
$ E: num 5
Or, you can provide a logical vector