Learn R Programming

validate (version 1.1.5)

barplot,validation-method: Plot number of violations

Description

Plot number of violations

Usage

# S4 method for validation
barplot(
  height,
  ...,
  order_by = c("fails", "passes", "nNA"),
  stack_by = c("fails", "passes", "nNA"),
  topn = Inf,
  add_legend = TRUE,
  add_exprs = TRUE,
  colors = c(fails = "#FB9A99", passes = "#B2DF8A", nNA = "#FDBF6F")
)

Value

A list, containing the bar locations as in barplot

Arguments

height

an R object defining height of bars (here, a validation object)

...

parameters to be passed to barplot but not height, horiz, border,las, and las.

order_by

(single character) order bars decreasingly from top to bottom by the number of fails, passes or NA's.

stack_by

(3-vector of characters) Stacking order for bar chart (left to right)

topn

If specified, plot only the top n most violated calls

add_legend

Display legend?

add_exprs

Display rules?

colors

Bar colors for validations yielding NA or a violation

Credits

The default colors were generated with the RColorBrewer package of Erich Neuwirth.

See Also

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

Examples

Run this code
data(retailers)
cf <- check_that(retailers
    , staff.costs < total.costs
    , turnover + other.rev == total.rev
    , other.rev > 0
    , total.rev > 0)
barplot(cf)

Run the code above in your browser using DataLab