.names
.keep_if_named.Rd
Filter an object to only contained elements with desired .names
.
keep_if_named(x, .names)
x | A named R object. |
---|---|
.names |
|
Those elements of x
whose name is in .names
.
library(salinasr) ages <- c(Tom = 20, Mary = 19, Sue = 43, Joe = 62) ages#> Tom Mary Sue Joe #> 20 19 43 62keep_if_named(ages, c("Mary", "Sue"))#> Mary Sue #> 19 43