check_y: Check vector

Description Usage Arguments Value Examples

View source: R/ClassicRNG.R

Description

Check vector

Usage

1
2
3
4
5
6
7
8
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

1
2
y <- sample(letters,10)
check_y(y, responseAlternatives=letters)

FredHasselman/randseqR documentation built on May 29, 2020, 11:57 a.m.