matches_coding {rcoder} | R Documentation |
Checks if vector's content adheres to a coding
Description
Performs to check to see if the set of vector values are equal to or a subset of a coding's values.
Usage
matches_coding(vec, coding, ignore_empty = TRUE)
verify_matches_coding(vec, coding, ignore_empty = TRUE)
Arguments
vec |
A vector |
coding |
A 'coding' object |
ignore_empty |
Logical flag to skip check if coding is empty |
Value
TRUE/FALSE
Functions
-
verify_matches_coding()
: Rather than returning TRUE/FALSE, this function halts execution if 'matches_coding()' returns FALSE.
Examples
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)
[Package rcoder version 0.3.0 Index]