Learn R Programming

NMdata (version 0.2.3)

deprecatedArg: Report if an argument is deprecated.

Description

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

Usage

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

Value

The coalesced value of arguments

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.

See Also

Other arguments: getArgs()

Examples

Run this code
if (FALSE) {
   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)
   )
}

Run the code above in your browser using DataLab