pyramid | R Documentation |
pyramid
pyramid( tab, gap = 0, left = list(col = "red"), right = list(col = "blue"), ... )
tab |
table: a table with two columns |
gap |
numeric(2): relative size of gap in |
left |
list: parameters for the left polygons (default: |
right |
list: parameters for the right polygons (default: |
... |
further parameters to use in graphics::plot.default |
a pyramid plot
data("Boston", package="MASS") tab <- table(data.frame(Boston$rad, Boston$chas)) pyramid(tab, main="Absolute frequencies") pyramid(tab, gap=c(0.2, 0.2)) rtab <- tab/sum(tab) pyramid(rtab, gap=c(0.2, 0.2), main="Relative frequencies") ctab <- proportions(tab, 2) pyramid(ctab, gap=c(0.2, 0.2), main="Conditional frequencies on columns") rtab <- proportions(tab, 1) pyramid(rtab, gap=c(0.2, 0.2), main="Conditional frequencies on rows") # zebraing pyramid(tab, gap=c(0.2, 0.2), left=list(list(col="black"), list(col="white")), right=list(list(col="blue"), list(col="green")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.