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.
if (FALSE) {
# Example: population summary for Indonesia, 2020data_idn <- pop_data_by_year(load_pop_data(), 2020) |>
pop_data_by_reg(0) # Indonesiapop_summary(data_idn)
}