Description Usage Arguments Value Examples
A error message generator, for checking classes of variables used in functions.
1 | checkVariables(obj, expect_class, vari)
|
obj |
Variable object |
expect_class |
A string value of the expected class type |
vari |
A string value of the function variable name |
Null if no error occured, otherwise returns a custom error message.
1 2 3 4 5 6 7 8 9 | # Will produce an error
a <- function(x){
if (!is.null(err <- checkVariables(obj = x, req_class = "numerical", vari = "x"))) stop(err)
return(x + 10)
}
# Will produce a costum error
a("one")
# Will execute the entire function
a(1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.