fig_poppyramid {whomds} | R Documentation |
Print a population pyramid
Description
Print a population pyramid
Usage
fig_poppyramid(
df,
var_age,
var_sex,
x_axis = c("n", "pct"),
age_plus = 100,
age_by = 5
)
Arguments
df |
a data frame of individual survey data, where each row is an individual |
var_age |
a string (length 1) of the name of the age column |
var_sex |
a string (length 1) of the name of the sex column |
x_axis |
a string (length 1) indicating whether to use absolute numbers or sample percentage on the x-axis. Choices are |
age_plus |
a numeric value (length 1) indicating the age that is the first value of the oldest age group. Default is 100, for the last age group to be 100+ |
age_by |
a numeric value (length 1) indicating the width of each age group, in years. Default is 5. |
Details
A population pyramid gives an image of the age and sex distribution of a population.
The function divides the var_age
variable into intervals of width age_by
.
Value
A population pyramid figure
See Also
Other figure functions:
fig_LID()
,
fig_density()
,
fig_dist()
Examples
fig_poppyramid(df_adults, "age", "sex")