deprecatedArg {NMdata} | R Documentation |
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)
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. |
Value
The coalesced value of arguments
See Also
Other arguments:
getArgs()
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)
[Package NMdata version 0.1.6 Index]