validate | R Documentation |
EXPERIMENTAL Minimalistic mutli-criteria data validation. Designed to
work nicely together with assert_all()
(see examples)
validate(..., .all = TRUE)
... |
Arbitrary expressions that evaluate to either |
.all |
|
a named logical
vector that is guranteed to have no NAs
.
validation <- validate(
all(iris$Petal.Length < 5),
`all species are valid` = all(iris$Species %in% c("setosa", "versicolor", "virginica")),
`all sepals are small` = all(iris$Sepal.Length < 1)
)
# validate can be used `with()` for added convenience:
validation <- with(iris, validate(
all(Petal.Length < 5),
`all species are valid` = all(Species %in% c("setosa", "versicolor", "virginica")),
`all sepals are small` = all(Sepal.Length < 1)
))
# validate works together with assert_all to produce nice errors
try(
assert_all(validation)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.