Find matching parameters by name

Description

Finds elements in a list whose names match some given arguments

Usage

1
  matching(x, ..., .notmatching = FALSE)

Arguments

x

named list, input elements

...

named lists, functions or function names x is to be matched against, see the details

.notmatching

if TRUE, the opposite is done: return all elements whose names do not match the given arguments.

Details

For functions or functions names contained in ..., the argument list is matched. This works only for non primitive functions.

Value

a style list containing those elements of x whose names match the arguments, see details.

Author(s)

Ute Hahn, ute@imf.au.dk

Examples

1
2
3
4
5
6
7
8
A <- list(col = "red", xlab = "x", u = 13, v = 91)
B <- list(u = 5, t = 2)
str(matching(A, B))
str(matching(A, "plot.default"))
str(matching(A, plot.default, B))

# using predefined lists for graphical parameters, and plot.default parameters
str(matching(A, .graphparams, .plotparams))