R/tests-helper-functions.R

#' Check if input contains any NA values.
#' @param x A vector to check.
contains_na <- function(x) {
  if (any(is.na(x))) return(TRUE)
  return(FALSE)
}

#' Checks if an input vector is valid.
#' @param x A vector to check.
is_valid_input <- function(x) {
  if (is.null(x)) return(FALSE)
  if (contains_na(x)) return(FALSE)
  return(TRUE)
}
kahaaga/tstools documentation built on May 24, 2019, 5:01 a.m.