percDF: Creates percentage of a dataframe

Description Usage Arguments Value Examples

View source: R/percDF.R

Description

Creates a dataframe in long format and in percent

Usage

1
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

1
2
3
df <- popPyramid::popPER
df <- dplyr::filter(df, Year==2021)
df <- percDF(df, "Age", "Sex", "Population")

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