field_length | R Documentation |
A convenience function testing for field length.
field_length(x, n = NULL, min = NULL, max = NULL, ...)
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 |
A [logical]
of size length(x)
.
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.
Other format-checkers:
field_format()
,
number_format()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.