mosaicize | R Documentation |
Found at http://stackoverflow.com/questions/19233365/how-to-create-a-marimekko-mosaic-plot-in-ggplot2 Modified (e.g. to pass R check)
mosaicize(data)
data |
A data.frame with exactly two columns |
Returns a data frame, which can be used for plotting and has the following columns: 'Var1' - marginalized values from 1st input column 'Var2' - marginalized values from 2nd input column 'Freq' - relative frequency of the combination given in [Var1, Var2] 'margin_var1' - frequency of the value given in Var1 'var2_height' - frequency of the value given in Var2, relative to Var1 'var1_center' - X-position when plotting (large sets get a larger share)
Data.frame
data = data.frame(raw.file = c(rep('file A', 100), rep('file B', 40)),
charge = c(rep(2, 60), rep(3, 30), rep(4, 10),
rep(2, 30), rep(3, 7), rep(4, 3)))
mosaicize(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.