View source: R/proficiency_tools.R
crosstabplot | R Documentation |
Improves labeling of mosaic plots over mosaic
from the vcd package
crosstabplot(
data,
rowvar,
colvar,
varnames,
title = NULL,
subtitle = NULL,
label = FALSE,
shade = TRUE,
...
)
data |
a data object, matrix or dataframe, that contains the categorical variables to compose the crosstab |
rowvar |
a character value for the column in data that will be displayed on the rows of the crosstab |
colvar |
a character value for the column in data that will be displayed in columns of the crosstab |
varnames |
a character vector of length two with the labels for rowvar and colvar respectively |
title |
a character vector of length one that contains the main title for the plot |
subtitle |
a character vector of length one that contains the subtitle displayed beneath the plot |
label |
logical, if TRUE cells will be labeled, else they will not |
shade |
logical, if TRUE cells will be shaded with Pearson residuals |
... |
additional arguments to |
A mosaic plot
mosaic
which this function wraps
crosstabs
which does the data manipulation for the crosstab
df <- data.frame(cbind(x=seq(1,3,by=1), y=sample(LETTERS[6:8],60,replace=TRUE)),
fac=sample(LETTERS[1:4], 60, replace=TRUE))
varnames<-c('Quality','Grade')
myCT <- crosstabs(df, rowvar = "x",colvar = "fac", varnames = varnames, digits =2)
crosstabplot(df, rowvar = "x",colvar = "fac", varnames = varnames,
title = 'My Plot', subtitle = 'Foo', label = FALSE, shade = TRUE, digits = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.