rule {dataverifyr} | R Documentation |
Creates a single data rule
Description
Creates a single data rule
Usage
rule(expr, name = NA, allow_na = FALSE, negate = FALSE, ...)
## S3 method for class 'rule'
print(x, ...)
Arguments
expr |
an expression which dictates which determines when a rule is good.
Note that the expression is evaluated in |
name |
an optional name for the rule for reference |
allow_na |
does the rule allow for NA values in the data? default value is FALSE.
Note that when NAs are introduced in the expression, |
negate |
is the rule negated, only applies to the expression not allow_na,
that is, if |
... |
additional arguments that are carried along for your documentation, but are not used. Could be for example date, person, contact, comment, etc |
x |
a rule to print |
Value
The rule values as a list
Methods (by generic)
-
print(rule)
: Prints a rule
Examples
r <- rule(mpg > 10)
r
r2 <- rule(mpg > 10, name = "check that mpg is reasonable", allow_na = TRUE,
negate = FALSE, author = "me", date = Sys.Date())
r2
check_data(mtcars, r)
rs <- ruleset(
rule(mpg > 10),
rule(cyl %in% c(4, 6)), # missing 8
rule(qsec >= 14.5 & qsec <= 22.9)
)
rs
check_data(mtcars, rs)