powered by
Check that a vector conforms to a certain pattern.
chk_regex(x, pattern)chk_max_length(x, len)
chk_max_length(x, len)
A logical vector flagging records that have passed or failed the check.
A vector to check.
A str_detect() pattern to match.
Maximum string length.
Checks: data frame helpers
Expectations: patterns
Other vector checks: chk-dates, chk-dummy, chk-labels, chk-text, chk-uniqueness, chk-values
chk-dates
chk-dummy
chk-labels
chk-text
chk-uniqueness
chk-values
x <- c("a_1", "b_2", "c_2", NA, "NULL") chk_regex(x, "[a-z]_[0-9]") chk_max_length(x, 3)
Run the code above in your browser using DataLab