View source: R/check_non_null.R
check_non_null | R Documentation |
Check whether two or more arguments that may replace each other are NULL or NA.
check_non_null(x)
assert_non_null(x, .var.name = checkmate::vname(x), comment = NULL, add = NULL)
x |
[any] |
.var.name |
[ |
comment |
[ |
add |
[ |
In some functions, one argument may replace another. The check is used to ensure that at least on of the arguments have a value. Specific checks for each argument should be used in addition.
Depending on the function prefix:
If the check is successful, the function
assert_non_null
return x
invisibly, whereas
check_non_null
return TRUE
.
If the check is not successful,
assert_non_null
throws an error message and
check_non_null
returns a string with the error message.
data <- NULL
nrows_in_data <- 56
check_non_null(x = list(data, nrows_in_data))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.