R/assertions.R

Defines functions is_count

is_count <- function(x, null_ok = FALSE) {
  if (null_ok && is.null(x)) {
    return(TRUE)
  }
  is.numeric(x) && length(x) == 1L && !is.na(x) && as.integer(x) == x && x > 0L
}

Try the treasury package in your browser

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

treasury documentation built on Aug. 27, 2025, 1:09 a.m.