This function adds matching support for S4 methods with formals that aren't
identical to the generic, and use a nested .local
call.
Usage
standardizeCall(
which = sys.parent(n = 1L),
defaults = TRUE,
expandDots = TRUE,
return = c("call", "list"),
verbose = getOption(x = "verbose", default = FALSE)
)
Arguments
- which
the frame number if non-negative, the number of frames to go back if negative.
- defaults
logical(1)
. Include default arguments in the call.- expandDots
logical(1)
. Should arguments matching...
in the call be included or left as a...
argument?- return
character(1)
. Return type. Usesmatch.arg()
internally and defaults to the first argument in thecharacter
vector.- verbose
logical(1)
. Run the function with verbose output.
Value
call
: Matched call.list
: Verbose list that includes additional information about how the call was standardized. Recommended for debugging purposes only.
Examples
aaa <- "AAA"
bbb <- "BBB"
## Standard function.
testing <- function(a, b) {
standardizeCall()
}
testing(aaa, bbb)
#> testing(a = aaa, b = bbb)
## Inside S4 method.
setGeneric(
name = "testing",
def = function(a, ...) {
standardGeneric("testing")
}
)
#> [1] "testing"
setMethod(
f = "testing",
signature = signature(a = "character"),
definition = function(a, b, ...) {
standardizeCall()
}
)
testing(aaa, bbb)
#> testing(a = aaa, b = bbb)