Alters the built-in function match.call() by providing an additional argument which means that by default a user can specify how far up the call stack they want to match a call of. See match.call() for more details.

match.call2(
  n = 0L,
  definition = sys.function(sys.parent(n + 1L)),
  call = sys.call(sys.parent(n + 1L)),
  expand.dots = TRUE,
  envir = parent.frame(n + 3L)
)

Arguments

n

How far up the call-stack they would like to extract. The default, n=0 produces the same result as match.call() so this can be inserted wherever match.call() is used.

definition

a function, by default the function from which match.call2() is called.

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.

Value

An object of class call

Examples

f <- function(n) { g(n) } g <- function(n) { h(n) } h <- function(n) { match.call2(n) } f(0)
#> h(n = n)
f(1)
#> g(n = n)
f(2)
#> f(n = 2)