View source: R/deprecatedArg.R
deprecatedArg | R Documentation |
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)
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. |
The coalesced value of arguments
Other arguments:
getArgs()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.