match.call: Argument Matching

Description Usage Arguments Details Value References See Also Examples

View source: R/match.R

Description

match.call returns a call in which all of the specified arguments are specified by their full names.

Usage

1
2
3
4
match.call(definition = sys.function(sys.parent()),
           call = sys.call(sys.parent()),
           expand.dots = TRUE,
           envir = parent.frame(2L))

Arguments

definition

a function, by default the function from which match.call is called. See details.

call

an unevaluated call to the function specified by definition, as generated by call.

expand.dots

logical. Should arguments matching ... in the call be included or left as a ... argument?

envir

an environment, from which the ... in call are retrieved, if any.

Details

‘function’ on this help page means an interpreted function (also known as a ‘closure’): match.call does not support primitive functions (where argument matching is normally positional).

match.call is most commonly used in two circumstances:

Calling match.call outside a function without specifying definition is an error.

Value

An object of class call.

References

Chambers, J. M. (1998) Programming with Data. A Guide to the S Language. Springer.

See Also

sys.call() is similar, but does not expand the argument names; call, pmatch, match.arg, match.fun.

Examples

1
2
3
4
5
6
match.call(get, call("get", "abc", i = FALSE, p = 3))
## -> get(x = "abc", pos = 3, inherits = FALSE)
fun <- function(x, lower = 0, upper = 1) {
  structure((x - lower) / (upper - lower), CALL = match.call())
}
fun(4 * atan(1), u = pi)

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.