keep_if_named: Filter an object to only contained elements with desired...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

Filter an object to only contained elements with desired .names.

Usage

1
keep_if_named(x, .names)

Arguments

x

A named R object.

.names

character, vector of names by which to filter x.

Value

Those elements of x whose name is in .names.

Author(s)

Brendan Knapp brendan.g.knapp@gmail.com

See Also

rlang::is_named()

Examples

1
2
3
4
5
library(salinasr)

ages <- c(Tom = 20, Mary = 19, Sue = 43, Joe = 62)
ages
keep_if_named(ages, c("Mary", "Sue"))

knapply/salinasr documentation built on May 27, 2019, 2:09 p.m.