| keep_at | R Documentation |
keep_at() and discard_at() are similar to [ or dplyr::select(): they
return the same type of data structure as the input, but only containing
the requested elements. (If you're looking for a function similar to
[[ see pluck()/chuck()).
keep_at(x, at)
discard_at(x, at)
keep()/discard() to keep/discard elements by value.
x <- c(a = 1, b = 2, cat = 10, dog = 15, elephant = 5, e = 10)
x |> keep_at(letters)
x |> discard_at(letters)
# Can also use a function
x |> keep_at(\(x) nchar(x) == 3)
x |> discard_at(\(x) nchar(x) == 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.