Skip to contents

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

Usage

rows_for_rules(data_formatted, report, broken_rules, rows)

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.

Value

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

Examples

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)
#> Warning: All variables in the rules csv should be in the data csv and vice versa for the validation to work correctly. Download the Data Template for an example of correctly formatted upload. Ignoring these unmatched variables FilterDiameter, FilterPoreSize, ImageFile, ImageType, SampleID, SampleSize, Project, Affiliation

# 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)
#> Warning: This rule applies to the entire dataset.