Learn R Programming

censuspyrID (version 1.0.2)

pop_data_by_year: Filter Population Data by Year

Description

Filter population data for a specific census year. This function is intended for use with population datasets loaded via load_pop_data(), but can work with any data frame that contains a year column.

Usage

pop_data_by_year(data, yr)

Value

A tibble (or data frame) containing only rows from the specified year.

Arguments

data

A data frame or tibble containing population data. Must include a column named year.

yr

Integer or numeric. The census year to filter by.

See Also

load_pop_data(), pop_data_by_reg()

Examples

Run this code
# Load harmonized data first
dat <- load_pop_data(harmonized = TRUE, smoothing = 1)

# Filter for the 2000 census year
pop_data_by_year(dat, 2000)

Run the code above in your browser using DataLab