Learn R Programming

validatesuggest (version 0.3.2)

write_range_check: Suggest a range check

Description

Suggest a range check

Usage

write_range_check(d, vars = names(d), min = TRUE, max = FALSE, file = stdout())

suggest_range_check(d, vars = names(d), min = TRUE, max = FALSE)

Value

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.

Arguments

d

data.frame, used to generate the checks

vars

character optionally the subset of variables to be used.

min

TRUE or FALSE, should the minimum value be checked?

max

TRUE or FALSE, should the maximum value be checked?

file

file to which the checks will be written to.

Examples

Run this code
data(SBS2000, package="validate")

suggest_range_check(SBS2000)

# checks the ranges of each variable
suggest_range_check(SBS2000[-1], min=TRUE, max=TRUE)

# checks the ranges of each variable
suggest_range_check(SBS2000, vars=c("turnover", "other.rev"), min=FALSE, max=TRUE)

Run the code above in your browser using DataLab