expect_values_only_in: Check that values in a discrete or categorical vector are...

Description Usage Arguments Examples

View source: R/data_expectations.R

Description

Check that values in a discrete or categorical vector are within a set of acceptable values

Usage

1
expect_values_only_in(test_vector, correct_vector)

Arguments

test_vector

vector to test

correct_vector

vector of all acceptable values

Examples

1
2
3
4
5
expect_values_only_in(mtcars$cyl, c(2, 4, 6))
# Error in expect_values_only_in(mtcars$cyl, c(2, 4, 6)) :
#   8 value not found in list given
expect_values_only_in(mtcars$cyl, c(2, 4, 6, 8))
# [1] "all values expected...OK"

dgarmat/dgfunctionpack documentation built on May 17, 2020, 9:58 p.m.