File: utils_interpret.R

package info (click to toggle)
r-cran-effectsize 0.8.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,404 kB
  • sloc: sh: 17; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 447 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#' @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]])
}