named_like | R Documentation |
Subset objects by name using a regular expression
named_like(x, pattern, ...)
not_named_like(x, pattern, ...)
x |
An object with names. |
pattern |
A regular expression string (see regex). |
... |
Passed in to |
For named_like
: x[grepl(pattern, names(x), ...)]
.
For not_named_like
: x[! grepl(pattern, names(x), ...)]
.
vec <- c(one = 1, two = 2, three = 3, four = 4)
vec |> named_like("^t")
vec |> not_named_like("e$")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.