View source: R/input_check_response.R
| input_check_response | R Documentation |
This function provides a standardized response to input checks, ensuring consistency.
input_check_response(
check,
var_name = NULL,
error = TRUE,
prefix = "Input {.var {var_name}} is bad:"
)
check |
[ Can also be a |
var_name |
[ |
error |
[ |
prefix |
[ |
TRUE if check is TRUE (or any element in check is TRUE, if check
is a list) . Else, depending on error:
If error is TRUE, throws an error.
If error is FALSE, returns FALSE.
Other package helpers:
Dictionary,
Storage,
check_missing(),
find_namespace_calls(),
identical_structure(),
match_arg(),
package_logo(),
print_data.frame(),
print_matrix(),
system_information(),
unexpected_error(),
user_confirm()
x <- "1"
y <- 1
### check is successful
input_check_response(
check = checkmate::check_character(x),
var_name = "x",
error = TRUE
)
### alternative checks
input_check_response(
check = list(
checkmate::check_character(x),
checkmate::check_character(y)
),
var_name = "x",
error = TRUE
)
### standardized check response
## Not run:
input_check_response(
check = checkmate::check_character(y),
var_name = "y",
error = TRUE
)
input_check_response(
check = list(
checkmate::check_flag(x),
checkmate::check_character(y)
),
var_name = "y",
error = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.