check_arg | R Documentation |
check arguments by custom function
check_arg(..., n = 2, fun = not.null)
... |
arguments |
n |
how many arguments should meet the custom conditions |
fun |
custom conditions defined by a function |
logical value
x <- 1
y <- 3
z <- NULL
func <- function(x = NULL, y = NULL, z = NULL) {
if (check_arg(x, y, z, n = 2)) {
print("As expected, two arguments is not NULL")
}
if (check_arg(x, y, z, n = 1, method = ~ .x < 2)) {
print("As expected, one argument less than 2")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.