df <- data.frame(number = c("12.34","0.23E55","0.98765E12"))
rules <- validator(
number_format(number, format="dd.dd")
, number_format(number, "0.ddEdd")
, number_format(number, "0.*Edd")
)
out <- confront(df, rules)
values(out)
# a few examples, without 'validator'
number_format("12.345", min_dig=2) # TRUE
number_format("12.345", min_dig=4) # FALSE
number_format("12.345", max_dig=2) # FALSE
number_format("12.345", max_dig=5) # TRUE
number_format("12,345", min_dig=2, max_dig=3, dec=",") # TRUE
Run the code above in your browser using DataLab