dbInfo: Population database dimension information

View source: R/dbAccess.R

dbInfoR Documentation

Population database dimension information

Description

Reads a population database file (population, births, deaths) and returns list with unique values for each of Year, Type, TypeID, Age and Sex. Database path can be either a full path to a csv database file with the correct columns, or a vector including the data type, region type and year of database to be used through getDBPath. For example, db_path = c("estimates", "HA", "19") would return info for the July 1st 2019 population estimates database for Local Health Areas.

Note that dbCheck is run before pulling info. User will be warned if any database checks fail.

Usage

dbInfo(db_path, full_BC = TRUE)

Arguments

db_path

Either vector of database type ("estimates", "projections", "births", "deaths"), region code and two-character year OR full path to database csv file.

full_BC

Logical value whether the region covers all of BC. Those regions (e.g., CMAs) that do not cover all of BC have full_BC = FALSE, and their sum is not checked against the BC total. Default = TRUE.

Details

The complete list of region IDs and ages for each type of database (population, deaths, births) can be found in dbutils. For historical reasons, population data is saved as POPRREYY (population estimates), POPRRPYY (population projections), BIRRRYY (births) or DEARRYY (deaths), where RR is the shorthand for the region code, and YY is the last two digits of the year.

Value

List structure with unique values for Year, Type, TypeID, Age and Sex.

Author(s)

Sebastien Lavoie (formerly, BC Stats)

See Also

Overall package documentation: dbutils()

Other database access helpers: dbCheck(), dbRead(), dbWrite(), getDBPath()

Examples

## Not run:   dbInfo("I://PopulationR/Database/Estimates/POPHAE19.csv")  
dbInfo(c("estimates", "HA", "19"))
dbInfo(c("projections", "RD", "19"))

bcgov/dbutils documentation built on Sept. 30, 2022, 12:04 a.m.