From c938b832648fa46f5f3ccaf223927a5b01cd610e Mon Sep 17 00:00:00 2001 From: Joyce Robbins Date: Mon, 7 Oct 2019 16:21:18 -0400 Subject: [PATCH] remove mosaicplot examples --- mosaic.Rmd | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/mosaic.Rmd b/mosaic.Rmd index 26178e726..809e7b5f5 100644 --- a/mosaic.Rmd +++ b/mosaic.Rmd @@ -37,7 +37,14 @@ mosaic(Favorite ~ Age + Music, It is best to draw mosaic plots incrementally: start with splitting on one variable and then add additional variables one at a time. The full mosaic plot will have one split per variable. -Important: if your data is in a data frame (see above), **the count column must be called `Freq`**. +Important: if your data is in a data frame, as in the example below, **the count column must be called `Freq`**. (Tables and matrices also work, see `?vcd::structable` for more details.) + +Also note that all of these plots are drawn with `vcd::mosaic()` not the base R function, `mosaicplot()`. + +The data: +``` {r} +df +``` Split on `Age` only: @@ -140,19 +147,6 @@ mosaic(Favorite ~ Age + Music, ``` - -## Mosaic using base R - -```{r message=FALSE} -library(vcdExtra) -mosaicplot(xtabs(count ~ lake + sex, data=Alligator), main="") -``` - -```{r} -mosaicplot(xtabs(Freq ~ Favorite + Age + Music, data=df), main="", - dir=c('h', 'v', 'v')) -``` - ### Mosaic using vcd::doubledecker ```{r}