select_any_of {figma}R Documentation

Select any of the elements in a object

Description

Safely select elements of a named object (like a named R list).

Usage

select_any_of(x, elements)

Arguments

x

A object with names attribute (usually a named R list);

elements

A vector of strings with the name of the elements to search for;

Details

This functions works in a similar way to dplyr::any_of(). It tries to select any element of x that is in the vector given by the user in the elements argument.

In other words, if the user gives the vector c("a", "c", "e"), select_any_of() will search for elements "a", "c" and "e" in the x object, and will select any of these elements if it finds them.

But dplyr::any_of() is designed to work with columns of a data.frame, and figma::select_any_of() is designed to work specially with elements of a named list (although it can be used to select columns of a data.frames as well).

Value

A subset of the x if it finds any of the elements described in the element argument.


[Package figma version 0.2.0 Index]