as.data.frame-validatorComparison-method: Translate a validatorComparison object to data frame

as.data.frame,validatorComparison-methodR Documentation

Translate a validatorComparison object to data frame

Description

The performance of versions of a data set with regard to rule-based quality requirements can be compared using using compare. The result is a validatorComparison object, which can usefully be translated into a data frame.

Usage

## S4 method for signature 'validatorComparison'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

Object to coerce

row.names

ignored

optional

ignored

...

arguments passed to other methods

Value

A data frame with the following columns.

  • status: Row names of the validatorComparison object.

  • version: Column names of the validatorComparison object.

  • count: Contents of the validatorComparison object.

See Also

Other comparing: as.data.frame,cellComparison-method, barplot,cellComparison-method, barplot,validatorComparison-method, cells(), compare(), match_cells(), plot,cellComparison-method, plot,validatorComparison-method

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")

# create an overview of differences compared to raw data
out <- compare(rules, raw = step0, imputed = step1, flipped = step2)
out

# graphical overview
plot(out)
barplot(out)

# transform data to data.frame (easy for use with ggplot)
as.data.frame(out)



validate documentation built on July 4, 2024, 9:07 a.m.