R/utils_interpret.R

Defines functions .match.rules

#' @keywords internal
.match.rules <- function(rules, choices) {
  if (is.rules(rules)) {
    return(rules)
  }

  rule <- pmatch(rules, names(choices))

  if (!is.character(rules) || length(rules) != 1 || is.na(rule)) {
    insight::format_error(
      sprintf(
        "'rules' must be %s or an object of type 'rules'.",
        paste0("'", names(choices), "'", collapse = ", ")
      )
    )
  }

  return(choices[[rule]])
}

Try the effectsize package in your browser

Any scripts or data that you put into this service are public.

effectsize documentation built on Sept. 14, 2023, 5:07 p.m.