deprecatedArg function

Report if an argument is deprecated.

Report if an argument is deprecated.

Only supposed to be called from within a function. For now only works for arguments that have been replaced by others.

deprecatedArg(oldarg, newarg, args, msg = NULL, which = 2)

Arguments

  • oldarg: The deprecated argument name (a character string).
  • newarg: The non-deprecated argument name (a character string).
  • args: List of arguments in the function call to look for oldarg and newarg. See ?getArgs. If missing, getArgs() will be called from within deprecatedArg. See which too.
  • which: If calling getArgs this is passed along, referring to how many environments to jump to look at arguments.

Returns

The coalesced value of arguments

Examples

## Not run: fun1 <- function(a=1,b=2){ ## b is deprecated a <- deprecatedArg("b","a") a } expect_error( fun1(a=1,b=2) ) expect_message( fun1(b=2) ) ## End(Not run)

See Also

Other arguments: getArgs()

  • Maintainer: Philip Delff
  • License: MIT + file LICENSE
  • Last published: 2025-03-21