View source: R/utils_analysis_random.R
check_object_state | R Documentation |
check_object_state an Utility function to simplify checking object states.
check_object_state(check_exp, true_message, false_message = "")
check_exp |
An expression that should be evaluated |
true_message |
Message displayed on console and
returned if |
false_message |
Optional message returned if |
A utility function to evaluates the state of objects, and sends messages from server to UI of a shiny app.
A list is returned, with the following elements:
bool
is either true or false depending on check_exp
evaluation
content
either message and depended on check_exp
evaluation
check <- check_object_state(
check_exp = (is.null(NULL)),
true_message = as.data.frame("This is NULL")
)
# will eval to true and display message to console
check <- check_object_state(
check_exp = (length(c(1, 2)) == 0),
true_message = "this has 0 elements",
false_message = "this doesn't have 0 elements"
)
# This will not return check and check$content will be false_message
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.