Skip to contents

Verify that a given variable set as the expected number of values.

Usage

verify_numbers_values(var_name, values_set, expected_number)

Arguments

var_name

The name of the variable as string.

values_set

Vector with a the set of values.

expected_number

Expected numbers of unique value (excluding NA)

Value

If the number of unique value is different than the expected, it will show a warning.

Examples

verify_numbers_values("my_var", c("low", "borderline", "acceptable"), 3)
verify_numbers_values("my_var", c("low", "borderline", "acceptable", NA), 3)
verify_numbers_values("my_var", c("low", "acceptable", NA), 3)
#> Warning: Expecting 3 of values in my_var but got 2 unique values.
verify_numbers_values("my_var", c("none", "low", "borderline", "acceptable"), 3)
#> Warning: Expecting 3 of values in my_var but got 4 unique values.