Suggest a range check
data.frame
, used to generate the checks
character
optionally the subset of variables to be used.
TRUE
or FALSE
, should the minimum value be checked?
TRUE
or FALSE
, should the maximum value be checked?
file to which the checks will be written to.
suggest_range_check
returns validate::validator()
object with the suggested rules.
write_range_check
write the rules to file and returns invisibly a named list of ranges for each variable.
data(SBS2000, package="validate")
suggest_range_check(SBS2000)
#> Warning: Skipped range check 'id', as it is unique for each record
#> Object of class 'validator' with 10 elements:
#> RC1 : size %in% c("sc0", "sc3", "sc1", "sc2")
#> RC2 : incl.prob >= 0.02
#> RC3 : staff >= 1
#> RC4 : turnover >= 1
#> RC5 : other.rev >= -33
#> RC6 : total.rev >= 25
#> RC7 : staff.costs >= 2
#> RC8 : total.costs >= 22
#> RC9 : profit >= -222
#> RC10: vat >= 41
# checks the ranges of each variable
suggest_range_check(SBS2000[-1], min=TRUE, max=TRUE)
#> Object of class 'validator' with 10 elements:
#> RC1 : size %in% c("sc0", "sc3", "sc1", "sc2")
#> RC2 : in_range(incl.prob, 0.02, 0.14)
#> RC3 : in_range(staff, 1, 75)
#> RC4 : in_range(turnover, 1, 931397)
#> RC5 : in_range(other.rev, -33, 98350)
#> RC6 : in_range(total.rev, 25, 931397)
#> RC7 : in_range(staff.costs, 2, 221302)
#> RC8 : in_range(total.costs, 22, 2725410)
#> RC9 : in_range(profit, -222, 225493)
#> RC10: in_range(vat, 41, 9655)
# checks the ranges of each variable
suggest_range_check(SBS2000, vars=c("turnover", "other.rev"), min=FALSE, max=TRUE)
#> Object of class 'validator' with 2 elements:
#> RC1: turnover <= 931397
#> RC2: other.rev <= 98350