Learn R Programming

ospsuite.utils (version 1.2.0)

validateIsIncluded: Check if values are included

Description

Check if values are included

Usage

validateIsIncluded(values, parentValues, nullAllowed = FALSE)

Arguments

values

A vector of values.

parentValues

A vector of values where values are checked for inclusion.

nullAllowed

If TRUE, value can be NULL and the test always passes. If FALSE (default), NULL is not accepted and the test fails.

Value

Returns NULL if child value is included in parent value set, otherwise error is signaled.

Examples

Run this code
# NOT RUN {
A <- data.frame(
  col1 = c(1, 2, 3),
  col2 = c(4, 5, 6),
  col3 = c(7, 8, 9)
)

# will return NULL if child value is included in parent value set
validateIsIncluded("col3", names(A))
# }

Run the code above in your browser using DataLab