powered by
Function to create a pyramid plot
pyramid_plot( x, g, main = paste("Pyramid plot of", deparse(substitute(x)), "by", deparse(substitute(g))), xlab = paste(deparse(substitute(g)), "(", levels(g)[1], "/", levels(g)[2], ")"), ylab = deparse(substitute(x)) )
Pyramid plot
A vector (numeric, factor, character) holding age-groups
A binary categorical variable (usually sex)
Plot title
x-axis label
y-axis label
Mark Myatt
pyramid_plot( x = cut( testSVY$d2, breaks = seq(from = 60, to = 105, by = 5), include.lowest = TRUE ), g = testSVY$d3 )
Run the code above in your browser using DataLab