Skip to content

It's package that facilitates the elaboration of population pyramids

Notifications You must be signed in to change notification settings

musajajorge/popPyramid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

popPyramid

errero Open Source Love Project-Status:Active LinuxMint CRAN-status Downloads

popPyramid is a package that facilitates the elaboration of population pyramids.

Installation ⏬

Install popPyramid from CRAN:

install.packages("popPyramid")

or install popPyramid with

library(remotes)
install_github("musajajorge/popPyramid")

Usage 💪

Peru's population pyramid, year 2021

Using the default parameters.

df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
library(popPyramid)
plotPyramid(df=df, age="gAge", sex="Sex", pop="Population")

Peru's population pyramid, year 2021

Modifying the colors, X and Y axis labels, as well as the rotation of the X axis labels.

df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
library(popPyramid)
plotPyramid(df=df, age="gAge", sex="Sex", pop="Population",
            labx="Personas", laby="Grupo de edad",
            twocolors=c("steelblue","violetred3"),
            rotation=45, n.breaks=15, value.labels=FALSE)

Peru's population pyramid, year 2021

Modifying the position of the values in the bars.

df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
library(popPyramid)
plotPyramid(df=df, age="gAge", sex="Sex", pop="Population",
            value.labels=TRUE, position.value.labels = "out",
            size.value.labels=4)

Percentage pyramid of Peru's population, year 2021

Using the default parameters.

df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
df <- percDF(df, "gAge", "Sex", "Population")
library(popPyramid)
plotPercPyramid(df=df, age="gAge", sex="Sex", perpop="perc_Population")

Percentage pyramid of Peru's population, year 2021

Modifying the position of the values on the bars, the X and Y axis labels and the colors of the bars.

df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
df <- percDF(df, "gAge", "Sex", "Population")
library(popPyramid)
plotPercPyramid(df=df, age="gAge", sex="Sex", perpop="perc_Population",
                labx="% Personas", laby="Grupo de edad", n.breaks=10,
                twocolors=c("steelblue","violetred3"),
                value.labels=TRUE, position.value.labels="out",
                size.value.labels=4)


About

It's package that facilitates the elaboration of population pyramids

Topics

Resources

Stars

Watchers

Forks

Languages