R/checks.R

Defines functions check_bad_label_key check_bad_predicates

check_bad_predicates <- function(x) {
  have_name_idx <- have_name(x)

  if (any(have_name_idx)) {
    bad_x <- x[have_name_idx]
    bad_x_deparsed <- purrr::imap_chr(
      bad_x,
      ~ paste(.y, "=", quo_text(.x))
    )

    abort(
      sprintf(
        "Did you mistype some argument name? Or, did you mean `==`?: %s",
        paste(bad_x_deparsed, collapse = ",")
      )
    )
  }
}

check_bad_label_key <- function(x) {
  if (!quo_is_null(x) && !quo_is_symbol(x)) {
    abort("label_key must be a symbol")
  }
}

Try the gghighlight package in your browser

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

gghighlight documentation built on June 5, 2021, 5:06 p.m.