Learn R Programming

One4All (version 0.5)

rows_for_rules: Check which rows in the data violated the rules

Description

Get the rows in the data that violate the specified rules.

Usage

rows_for_rules(data_formatted, report, broken_rules, rows)

Value

A data frame with rows in the data that violate the specified rules.

Arguments

data_formatted

A formatted data frame.

report

A validation report generated by the 'validate' function.

broken_rules

A data frame with broken rules information.

rows

A vector of row indices specifying which rules from the suite of rules with errors to check for violations.

Examples

Run this code
data("invalid_example")
data("test_rules")
# Generate a validation report
result_invalid <- validate_data(files_data = invalid_example,
                        data_names = c("methodology", "particles", "samples"),
                        file_rules = test_rules)

# Find the broken rules
broken_rules <- rules_broken(results = result_invalid$results[[1]], show_decision = TRUE)

# Get rows for the specified rules
violating_rows <- rows_for_rules(data_formatted = result_invalid$data_formatted[[1]],
                                 report = result_invalid$report[[1]],
                                 broken_rules = broken_rules,
                                 rows = 1)

Run the code above in your browser using DataLab