select (and rename, if required) elements from list. Stop with message if elements do not exist
Arguments
- x
list
- elements
vector of element names. The names of named elements will be the names in the output list
- do.stop
this flag controls whether the function stops (
do.stop = TRUE
) or not (do.stop = FALSE
) if there are non-existing elements to be selected. Ifdo.stop = FALSE
only those elements are selected that actually exist- do.warn
if
TRUE
(default) anddo.stop = FALSE
a warning is given if elements do not exist. Set toFALSE
to suppress warnings
Value
list containing the elements of x
that are specified in
elements
or x[[elements]]
if length of elements
is 1
or list()
if elements
is empty. If the elements in vector
elements
are named, these names are used in the output list.