Check vector

check_y(
  y,
  minScale = NA,
  maxScale = NA,
  responseAlternatives = NA,
  noZero = FALSE,
  toNumeric = TRUE
)

Arguments

y

A vector. If not a numeric vector and toNumeric = TRUE, unique elements will be labelled by an integer value.

minScale

Minimum expected value. If y is a character vector this should refer to the lowest numeric code used.

maxScale

Maximum expected value. If y is a character vector this should refer to the highest numeric code used.

responseAlternatives

An optional vector of possible response alternatives. If NA, responseAlternatives will be set to seq(minScale,maxScale)

noZero

Can the series have value 0?

toNumeric

If TRUE, the unique elements in a non-numeric vector will be labelled by an integer value.

Value

Transformed y (if necessary), or, an error message.

Examples

y <- sample(letters,10) check_y(y, responseAlternatives=letters)
#> Error in check_y(y, responseAlternatives = letters): could not find function "check_y"