View source: R/validate_data.R
| validate_data | R Documentation |
Checks whether data conforms to user-specified rules such as column type, value range, uniqueness, and presence of missing values. Returns a report indicating which rules passed and which failed.
validate_data(data, rules, verbose = FALSE)
data |
A data frame to validate. |
rules |
A list of rules. Each rule is a list with components: |
verbose |
Logical; if |
A data frame with columns: rule, column, passed (logical), and message. If a rule passes, message is "OK"; otherwise it contains a description of the failure.
rules <- list(
list(column = "3.98", type = "numeric", min = 0, na_allowed = TRUE),
list(column = "monthyear", type = "character", unique = FALSE)
)
validate_data(data[1:50, c(1, 4, 17:19)], rules)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.