| Type: | Package | 
| Title: | Population Pyramids | 
| Version: | 0.1.1 | 
| Description: | Functions that facilitate the elaboration of population pyramids. | 
| Depends: | R (≥ 3.5.0) | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 7.1.1 | 
| URL: | https://github.com/musajajorge/popPyramid | 
| Imports: | tibble, dplyr, ggplot2 | 
| NeedsCompilation: | no | 
| Packaged: | 2021-12-15 13:08:55 UTC; jorge | 
| Author: | Jorge L. C. Musaja [aut, cre] | 
| Maintainer: | Jorge L. C. Musaja <musajajorge@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2021-12-15 19:50:02 UTC | 
Creates percentage of a dataframe
Description
Creates a dataframe in long format and in percent
Usage
percDF(df, age, sex, pop)
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. | 
| pop | Population (in numerical value). Write the parameter in quotation marks. | 
Value
The dataframe in long format and in percentage
Examples
df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
df <- percDF(df, "Age", "Sex", "Population")
Population percentage pyramid graph
Description
Create a population percentage pyramid graph
Usage
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
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)
Population pyramid graph
Description
Create a population pyramid graph
Usage
plotPyramid(
  df,
  age,
  sex,
  pop,
  labx = pop,
  laby = age,
  twocolors = c("#41ae76", "#ef6548"),
  rotation = 90,
  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. | 
| pop | 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 population pyramid graph
Examples
df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
plotPyramid(df=df, age="gAge", sex="Sex", pop="Population", value.labels=FALSE)
Peru population (1995-2030)
Description
Peru population (1995-2030)
Usage
popPER
Format
dataframe
- Year
- chr Year 
- Sex
- chr Sex 
- Age
- chr Age 
- gAge
- chr Age group 
- Population
- dbl Population