Description Usage Arguments Value Examples
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
.
1 2 | ## S3 method for class 'tabplot'
tp1 - tp2
|
tp1 |
the first tabplot-object |
tp2 |
the second tabplot-object |
a tabplot_compare-object that contains information about the comparison tp1-tp2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.