matching: Find matching parameters by name

Description Usage Arguments Details Value Author(s) Examples

View source: R/matchingnames.R

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 simplist 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))

plutils documentation built on May 2, 2019, 5:53 p.m.