R/utilities.R

Defines functions checkVecLength

## This function checks if the length of all vectors in a list
## is either "1" or has the same maximum value
checkVecLength <- function(x) {
  if (!is.list(x)) stop("x must be a list of vectors")
  alleng <- sapply(x, length)
  maxlen <- max(alleng)
  all((alleng == maxlen) | (alleng == 1))
}

Try the marelac package in your browser

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

marelac documentation built on Feb. 12, 2020, 3 a.m.