powered by
Performs to check to see if the set of vector values are equal to or a subset of a coding's values.
matches_coding(vec, coding, ignore_empty = TRUE)verify_matches_coding(vec, coding, ignore_empty = TRUE)
verify_matches_coding(vec, coding, ignore_empty = TRUE)
TRUE/FALSE
A vector
A `coding` object
Logical flag to skip check if coding is empty
verify_matches_coding(): Rather than returning TRUE/FALSE, this function halts execution if `matches_coding()` returns FALSE.
verify_matches_coding()
vec1 <- sample(1:2, 10, replace = TRUE) vec2 <- sample(0:1, 10, replace = TRUE) cdng <- coding(code("Yes", 1), code("No", 0)) matches_coding(vec1, cdng) matches_coding(vec2, cdng)
Run the code above in your browser using DataLab