R/validate_wrt_option.R

Defines functions validate_wrt_option

Documented in validate_wrt_option

#' Validate With Respect To Option
#'
#' Verify that the option provided is in the poster_samples dataframe `option_name` column.
#' Raises error if not TRUE
#'
#' @param wrt_option string name of the option
#' @param posterior_samples Tibble returned from sample_from_posterior with 3 columns
#'   `option_name`, `samples`, and `sample_id`.
#'
#' @return None
validate_wrt_option <- function(wrt_option, posterior_samples){
  if(!(wrt_option %in% posterior_samples$option_name)){
    stop(paste(wrt_option, "is an invalid wrt_option. Not one of in the posterior_samples options."))
  }
}
rangi513/grizbayr documentation built on Oct. 17, 2023, 1:22 a.m.