Examples for 'validate::barplot,validatorComparison-method'


Barplot of validatorComparison object

Aliases: barplot,validatorComparison-method

Keywords:

### ** Examples

data(retailers)

rules <- validator(turnover >=0, staff>=0, other.rev>=0)

# start with raw data
step0 <- retailers

# impute turnovers
step1 <- step0
step1$turnover[is.na(step1$turnover)] <- mean(step1$turnover,na.rm=TRUE)

# flip sign of negative revenues
step2 <- step1
step2$other.rev <- abs(step2$other.rev)

# create an overview of differences, comparing to the previous step
compare(rules, raw = step0, imputed = step1, flipped = step2, how="sequential")
Object of class validatorComparison:

   compare(x = rules, raw = step0, imputed = step1, flipped = step2, how = "sequential")

                    Version
Status               raw imputed flipped
  validations        180     180     180
  verifiable         134     138     138
  unverifiable        46      42      42
  still_unverifiable  46      42      42
  new_unverifiable     0       0       0
  satisfied          133     137     138
  still_satisfied    133     133     137
  new_satisfied        0       4       1
  violated             1       1       0
  still_violated       1       1       0
  new_violated         0       0       0
# create an overview of differences compared to raw data
out <- compare(rules, raw = step0, imputed = step1, flipped = step2)
out
Object of class validatorComparison:

   compare(x = rules, raw = step0, imputed = step1, flipped = step2)

                    Version
Status               raw imputed flipped
  validations        180     180     180
  verifiable         134     138     138
  unverifiable        46      42      42
  still_unverifiable  46      42      42
  new_unverifiable     0       0       0
  satisfied          133     137     138
  still_satisfied    133     133     133
  new_satisfied        0       4       5
  violated             1       1       0
  still_violated       1       1       0
  new_violated         0       0       0
# graphical overview
plot(out)
plot of chunk example-validate-barplot,validatorComparison-method-1
barplot(out)
plot of chunk example-validate-barplot,validatorComparison-method-1
# transform data to data.frame (easy for use with ggplot)
as.data.frame(out)
               status version count
1         validations     raw   180
2          verifiable     raw   134
3        unverifiable     raw    46
4  still_unverifiable     raw    46
5    new_unverifiable     raw     0
6           satisfied     raw   133
7     still_satisfied     raw   133
8       new_satisfied     raw     0
9            violated     raw     1
10     still_violated     raw     1
11       new_violated     raw     0
12        validations imputed   180
13         verifiable imputed   138
14       unverifiable imputed    42
15 still_unverifiable imputed    42
16   new_unverifiable imputed     0
17          satisfied imputed   137
18    still_satisfied imputed   133
19      new_satisfied imputed     4
20           violated imputed     1
21     still_violated imputed     1
22       new_violated imputed     0
23        validations flipped   180
24         verifiable flipped   138
25       unverifiable flipped    42
26 still_unverifiable flipped    42
27   new_unverifiable flipped     0
28          satisfied flipped   138
29    still_satisfied flipped   133
30      new_satisfied flipped     5
31           violated flipped     0
32     still_violated flipped     0
33       new_violated flipped     0

[Package validate version 1.1.1 Index]