validateIsIncluded: Check if values are included

View source: R/validation-helpers.R

validateIsIncludedR Documentation

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


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))

ospsuite.utils documentation built on March 18, 2022, 6:44 p.m.