R/assertions.R

Defines functions is_string

#' @importFrom assertthat assert_that on_failure<-

is_string <- function(x) {
  is.character(x) && length(x) == 1 && !is.na(x)
}

on_failure(is_string) <- function(call, env) {
  paste0(deparse(call$x), " is not a string (length 1 character)")
}
r-lib/revdepcheck documentation built on Oct. 22, 2024, 2:13 a.m.