standardizeCall: Standardize call

View source: R/standardizeCall.R

standardizeCallR Documentation

Standardize call

Description

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. Uses match.arg() internally and defaults to the first argument in the character 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.

Note

Updated 2020-01-09.

See Also

  • match.call().

  • sys.call().

  • sys.parent().

  • pryr::standardise_call().

  • stackoverflow::match.call.defaults().

Examples

aaa <- "AAA"
bbb <- "BBB"

## Standard function.
testing <- function(a, b) {
    standardizeCall()
}
testing(aaa, bbb)

## Inside S4 method.
setGeneric(
    name = "testing",
    def = function(a, ...) {
        standardGeneric("testing")
    }
)
setMethod(
    f = "testing",
    signature = signature(a = "character"),
    definition = function(a, b, ...) {
        standardizeCall()
    }
)
testing(aaa, bbb)

acidgenomics/r-acidbase documentation built on Jan. 12, 2024, 3:56 a.m.