check_object_state: Check object state

View source: R/utils_analysis_random.R

check_object_stateR Documentation

Check object state

Description

check_object_state an Utility function to simplify checking object states.

Usage

check_object_state(check_exp, true_message, false_message = "")

Arguments

check_exp

An expression that should be evaluated

true_message

Message displayed on console and returned if check_exp is true

false_message

Optional message returned if check_exp is false, default to blank string

Details

A utility function to evaluates the state of objects, and sends messages from server to UI of a shiny app.

Value

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

Examples

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


espors/idepGolem documentation built on April 23, 2024, 1:11 p.m.