#' @title
#' Check if the odds ratio parameters are sufficient
#'
#' @param .odds
#' Numeric: an odds ratio.
#'
#' @param .odds_lo
#' Numeric: the lower confidence interval of an odds ratio.
#'
#' @param .odds_up
#' Numeric: the upper confidence interval of an odds ratio.
#'
#' @return
#' A list of two values: is_valid (logical), and status (string).
#'
#' @export
validate_odds_ratio <- function(.odds = NA, .odds_lo = NA, .odds_up = NA) {
# Check if table parameters are missing.
if (any(is.na(c(.odds, .odds_lo, .odds_up)))) {
status <- "Error: missing parameter(s) for odds ratio."
return(list(
is_valid = FALSE,
status = status
))
# Check if data input are numeric.
} else if (all(class(c(.odds, .odds_lo, .odds_up)) != "numeric")) {
status <- "Error: parameter(s) are not of type 'numeric'."
return(list(
is_valid = FALSE,
status = status
))
} else {
status <- "OK: parameters pass checks for odds ratio."
}
return(list(
is_valid = TRUE,
status = status
))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.