Mosaic Plot"

# show grouped code output instead of single lines
# use '#>' for R outputs
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

Initial Situation and Goal

One way to get a view on the structure in categorical data is the mosaic plot. An example of this type of data is the dataset 'Titanic' which is available in the demo data within 'Cornerstone'. A possible result is the following graph.

knitr::include_graphics("imgs/mosaicPlot01.png")

How do we realize this result in 'Cornerstone' using 'Mosaic Plot' from 'CornerstoneR'?

Cornerstone Workflow

To achieve this result in 'Cornerstone' open a dataset, e.g. 'Titanic' and choose menu 'Analysis' -> 'CornerstoneR' -> 'Mosaic Plot' as shown in the following screenshot.

knitr::include_graphics("imgs/mosaicPlot02.png")

In the appearing dialog select variable 'pclass' and 'age' to predictors. 'sex' and 'survived' are the response variables.

knitr::include_graphics("imgs/mosaicPlot03.png")

'OK' confirms your selection and the following window appears.

knitr::include_graphics("imgs/mosaicPlot04.png")

Now, click the execute button (green arrow) or choose the menu 'R Script' -> 'Execute' and all calculations are done via 'R'. Calculations are done if the text at the lower left status bar contains 'Last execute error state: OK'. Our result is available via the menu 'Graphs' -> 'Mosaic Plot (PNG)' or 'Mosaic Plot (EMF)' as shown in the following screenshot.

knitr::include_graphics("imgs/mosaicPlot05.png")

After clicking this menu a 'Cornerstone' graph with the mosaic plot from R opens.

knitr::include_graphics("imgs/mosaicPlot01.png")


Try the CornerstoneR package in your browser

Any scripts or data that you put into this service are public.

CornerstoneR documentation built on Aug. 28, 2020, 5:09 p.m.