Learn R Programming

censuspyrID (version 1.0.2)

pop_summary: Print Population Summary Statistics

Description

Generate and print a formatted summary of population counts, percentages, sex ratio, and dependency ratios from a given dataset of population data for a specific province and year.

Usage

pop_summary(data)

Value

This function does not return an object. It prints formatted summary statistics to the console.

Arguments

data

A data frame of population data for a specific province and year, containing at least the variables: pop (population count), sex (coded as 1 = male, 2 = female), age5 (5-year age groups).

Details

The function calculates:

  • Total population

  • Male and female population counts and percentages

  • Age group distribution: 0–14, 15–64, and 65+ (counts and percentages)

  • Sex ratio (males per 100 females)

  • Dependency ratios (0–14, 65+, and total dependency ratio relative to 15–64)

Results are printed directly to the console in a formatted table.

See Also

load_pop_data(), pop_data_by_reg(), pop_data_by_year(), get_code_label()

Examples

Run this code
if (FALSE) {
# Example: population summary for Indonesia, 2020
data_idn <- pop_data_by_year(load_pop_data(), 2020) |>
  pop_data_by_reg(0) # Indonesia
pop_summary(data_idn)
}

Run the code above in your browser using DataLab