Description Usage Arguments Details Functions Examples
Create checks to add to Canonical Forms. Each of these functions returns a function which takes a dataframe and returns a CheckResult object.
1 2 3 4 5 | check_no_nas(cols)
check_greater_than(..., .strict = TRUE)
check_less_than(..., .strict = TRUE)
|
cols |
character vector of columns to include in the check |
... |
named arguments of the form (col = constraint) |
.strict |
should values equal to the constraint be disallowed? |
for check_greater_than
and check_less_than
, different values can be specified for each
column. See examples.
check_greater_than
: check that all values are above specified values
check_less_than
: check all values are less than constraints
1 2 3 4 5 6 7 8 9 10 11 12 | df <- data.frame(a = c(1, 2, NA), b = c(4, 5, 6))
check_na <- check_no_nas("a")
check_na(df) # fails
check_na2 <- check_no_nas("b")
check_na2(df) # passes
check_gt <- check_greater_than(a = 0, b = 3)
check_gt(df) # passes
check_gt2 <- check_greater_than(a = 1, b = 4, .strict = FALSE)
check_gt2(df) # passes (because .strict=FALSE)
check_gt3 <- check_greater_than(a = 1, b = 1, .strict = TRUE)
check_gt3(df) # fails
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.