Two tableplots can be compared by substracting two tabplot-objects. The result is a tabplot_compare-object object in which absolute and relative differences of mean values are stored, as well as a comparison of frequency tables for categorical variables. This object can be plotted with plot.
Usage
## S3 method for class 'tabplot'
tp1 - tp2
Arguments
tp1
the first tabplot-object
tp2
the second tabplot-object
Value
a tabplot_compare-object that contains information about the comparison tp1-tp2
Examples
# load diamonds dataset from ggplot2
require(ggplot2)
data(diamonds)
# calculate normalized prices to be used as sample probabilities
price.norm <- with(diamonds, price / max(diamonds$price))
# draw samples
exp.diamonds <- diamonds[sample(1:nrow(diamonds), size=10000, prob=price.norm, replace=TRUE),]
chp.diamonds <- diamonds[sample(1:nrow(diamonds), size=10000, prob=1-price.norm, replace=TRUE),]
tp1 <- tableplot(exp.diamonds)
tp2 <- tableplot(chp.diamonds)
plot(tp2 - tp1)