write_pos_check {validatesuggest}R Documentation

Suggest a range check

Description

Suggest a range check

Usage

write_pos_check(d, vars = names(d), only_positive = TRUE, file = stdout())

suggest_pos_check(d, vars = names(d), only_positive = TRUE)

Arguments

d

data.frame, used to generate the checks

vars

character optionally the subset of variables to be used.

only_positive

if TRUE only numerical values for positive values are included

file

file to which the checks will be written to.

Value

suggest_pos_check returns validate::validator() object with the suggested rules. write_pos_check write the rules to file and returns invisibly a named list of checks for each variable.

Examples

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)

[Package validatesuggest version 0.3.2 Index]