| field_length {validate} | R Documentation |
Check number of code points
Description
A convenience function testing for field length.
Usage
field_length(x, n = NULL, min = NULL, max = NULL, ...)
Arguments
x |
Bare (unquoted) name of a variable.
Otherwise a vector of class |
n |
Number of code points required. |
min |
Mimimum number of code points |
max |
Maximum number of code points |
... |
passed to |
Value
A [logical] of size length(x).
Details
The number of code points (string length) may depend on current locale
settings or encoding issues, including those caused by inconsistent choices
of UTF normalization.
See Also
Other format-checkers:
field_format(),
number_format()
Examples
df <- data.frame(id = 11001:11003, year = c("2018","2019","2020"), value = 1:3)
rule <- validator(field_length(year, 4), field_length(id, 5))
out <- confront(df, rule)
as.data.frame(out)
[Package validate version 1.1.5 Index]