plotPercPyramid: Population percentage pyramid graph

Description Usage Arguments Value Examples

View source: R/plotPercPyramid.R

Description

Create a population percentage pyramid graph

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotPercPyramid(
  df,
  age,
  sex,
  perpop,
  labx = perpop,
  laby = age,
  twocolors = c("#41ae76", "#ef6548"),
  rotation = 0,
  n.breaks = 20,
  value.labels = TRUE,
  position.value.labels = "in",
  size.value.labels = 3
)

Arguments

df

Name of dataframe

age

Age or age group. Write the parameter in quotation marks.

sex

Sex or other categorical grouping variable. Write the parameter in quotation marks.

perpop

Percentage of population (in numerical value). Write the parameter in quotation marks.

labx

X-axis label

laby

Y-axis label

twocolors

Two colors for the pyramid

rotation

X-axis label rotation

n.breaks

Number of breaks

value.labels

Show values in the bars. Use TRUE to include the labels in the bars. Use FALSE to not include them.

position.value.labels

Position of the values on the bars. Use "in" to display the labels inside the bars. Use "out" to display them outside the bars.

size.value.labels

Font size of the values in the bars

Value

A graph of the pyramid of population percentage

Examples

1
2
3
4
df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
df <- percDF(df, "gAge", "Sex", "Population")
plotPercPyramid(df=df, age="gAge", sex="Sex", perpop="perc_Population", value.labels=FALSE)

popPyramid documentation built on Dec. 16, 2021, 1:06 a.m.