Description Usage Arguments Details Value
Validates arguments. Allows partial matching.
1 | .validateArg(arg, parent = NULL, ignore.case = T)
|
arg |
variable; the variable in which to check |
parent |
closure; the parent function in which to check the input |
ignore.case |
boolean; ignores case of the choices |
Check the parent function input arguments to see whether the inputted value is part of the set. Will return a formatted error message with the incorrect variable name and all the acceptable inputs.
To use, it can be called as such:
genericFunc <- function(values = c("apple","orange","banana"))
values <- .validateArg(values)
If the argument for values is acceptable (e.g. "apple" or "ban"), it will return the matched string.
This can be used with pipes, but will give erroneous names for the input variable
arg, if the value is in the function definition.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.