vector_allowed_values: Checks if a vector contains values only out of a set of...

View source: R/vector.R

vector_allowed_valuesR Documentation

Checks if a vector contains values only out of a set of available options.

Description

Checks if a vector contains values only out of a set of available options.

Usage

vector_allowed_values(v, allowed_values)

Arguments

v

the vector

allowed_values

a vector of allowed values

Examples

## Not run: 
# For assertion.
# Will fail if v contains any value that is not either 1, 2 or 3
assertthat::assert_that(qscheck::vector_allowed_values(v, c(1, 2, 3)))
# For check
if (qscheck::vector_allowed_values(v, c(1, 2, 3))) {
}

## End(Not run)


AstraZeneca/qscheck documentation built on Nov. 1, 2023, 4:45 a.m.