R/utils.R

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

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

is_integerish <- function(x) {
  is.integer(x) || (is.numeric(x) && all(x == as.integer(x)))
}

random_id <- function() {
  paste(
    sample(c(0:9, "a", "b", "c", "d", "e", "f"), 16, replace = TRUE),
    collapse = ""
  )
}

Try the after package in your browser

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

after documentation built on Jan. 15, 2017, 9:49 a.m.