percDF {popPyramid}R Documentation

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")

[Package popPyramid version 0.1.1 Index]