Learn R Programming

validate (version 1.1.5)

sort,validation-method: Aggregate and sort the results of a validation.

Description

Aggregate and sort the results of a validation.

Usage

# S4 method for validation
sort(x, decreasing = FALSE, by = c("rule", "record"), drop = TRUE, ...)

Value

A data.frame with the following columns.

keysIf confront was called with key=
npassNumber of items passed
nfailNumber of items failing
nNANumber of items resulting in NA
rel.passRelative number of items passed
rel.failRelative number of items failing
rel.NARelative number of items resulting in NA

If by='rule' the relative numbers are computed with respect to the number of records for which the rule was evaluated. If by='record' the relative numbers are computed with respect to the number of rules the record was tested agains. By default the most failed validations and records with the most fails are on the top.

When by='record' and not all validation results have the same dimension structure, a list of data.frames is returned.

Arguments

x

An object of class validation

decreasing

Sort by decreasing number of passes?

by

Report on violations per rule (default) or per record?

drop

drop list attribute if the result has a single argument.

...

Arguments to be passed to or from other methods.

See Also

Other validation-methods: aggregate,validation-method, all,validation-method, any,validation-method, barplot,validation-method, check_that(), compare(), confront(), event(), names<-,rule,character-method, plot,validation-method, summary(), validation-class, values()

Examples

Run this code

data(retailers)
retailers$id <- paste0("ret",1:nrow(retailers))
v <- validator(
    staff.costs/staff < 25
  , turnover + other.rev==total.rev)

cf <- confront(retailers,v,key="id")
a <- aggregate(cf,by='record')
head(a)

# or, get a sorted result:
s <- sort(cf, by='record')
head(s)


Run the code above in your browser using DataLab