validate | R Documentation |
Validate objects
validate(., ..., .checklist = list(), .error_class = "validationError")
.f %checkout% .checks
. |
Object to validate. |
... |
Input-validation check formula(e). |
.checklist |
List of check formulae. (These are combined with check
formulae provided via |
.error_class |
Subclass of the error condition to be raised when an input validation error occurs (character). |
.f |
Interpreted function, i.e., closure. |
.checks |
List of check formulae, optionally containing a character
vector named |
## Not run:
library(magrittr)
# Valid assertions: data frame returned (invisibly)
mtcars %>%
validate(
vld_all(~sapply(., is.numeric)),
~{nrow(.) > 10},
vld_all(~c("mpg", "cyl") %in% names(.))
)
# Invalid assertions: error raised
mtcars %>%
validate(
vld_all(~sapply(., is.numeric)),
~{nrow(.) > 1000},
vld_all(~c("mpg", "cylinders") %in% names(.))
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.