R/assertions.R

Defines functions is_count is_flag is_character_or_null is_character is_string

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

is_character <- function(x) {
  is.character(x) && !any(is.na(x))
}

is_character_or_null <- function(x) {
  is.null(x) || is_character(x)
}

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

is_count <- function(x) {
  is.numeric(x) && length(x) == 1 && !is.na(x) &&
    as.integer(x) == x
}

Try the zip package in your browser

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

zip documentation built on April 17, 2023, 5:08 p.m.