R/valid_logical.R

Defines functions valid_logical

valid_logical <- function(x, name = "x") {
  if (!is.logical(x)) stop(name, " must be logical")
  if (length(x) != 1) stop(name, " must be length 1")
  if (is.na(x)) stop(name, " must not be missing")
  invisible(x)
}

Try the naflex package in your browser

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

naflex documentation built on Oct. 15, 2024, 9:10 a.m.