agepyramid | R Documentation |
Age Pyramid
agepyramid(
data,
age,
gender,
female,
bin_width = 5,
plot_title = "Age Pyramid",
color1 = "#1F77B4",
color2 = "#FF7F0E"
)
data |
The data as a data frame. |
age |
a string naming the variable from |
gender |
a string naming the variable from |
female |
a string naming the level from |
bin_width |
The width of the age bins in years. Adjust this to change the granularity of the age groups. |
plot_title |
The title displayed on the age pyramid plot. |
color1 |
First color for the pyramid chart bars. |
color2 |
Second color for the pyramid chart bars. |
A results object containing:
results$pyramidTable | a table | ||||
results$plot | an image | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$pyramidTable$asDF
as.data.frame(results$pyramidTable)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.