check_assertr_expression | R Documentation |
Defensive wrapper to add evaluation error to regular validation errors.
check_assertr_expression(this_call, data, description, error_fun)
this_call |
assertion command that is checked for valuation errors. |
data |
A data.frame or tibble to test. |
description |
A character string with description of assertion. |
error_fun |
Function that is called when the validation fails |
validation object with evaluation errors added to the list if occurred.
validate_if
## Not run:
library(fixtuRes)
library(magrittr)
library(assertr)
library(data.validator)
my_mock_generator <- fixtuRes::MockDataGenerator$new("fixtures_config.yml")
my_data_frame <- my_mock_generator$get_data("my_data_frame", 10)
report <- data.validator::data_validation_report()
validate(my_data_frame, name = "Verifying data uniqueness") %>%
validate_if(has_all_names("id", "code", "test"), description = "All columns are there") %>%
validate_if(is.character(test), description = "TEST column is string") %>%
validate_if(is_uniq(id), description = "ID column is unique") %>%
validate_if(!is.na(id) & id != "", description = "ID column is not empty") %>%
validate_if(is.character(code), description = "CODE column is string") %>%
validate_rows(col_concat, is_uniq, code, type, description = "CODE and TYPE is unique") %>%
add_results(report)
print(report)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.