getDBPath: Returns a correct full database path

View source: R/dbAccess.R

getDBPathR Documentation

Returns a correct full database path

Description

Returns a population database file (population, births, deaths) path. Database paths are hardcoded to ensure consistency across population systems. The script uses data type, region type and year to return an appropriate full path.

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.

Usage

getDBPath(dbType, dbRegion, dbYear)

Arguments

dbType

Type of database being written. Possible values are "estimates", "projections", "deaths", "births". Default = "estimates".

dbRegion

Two-digit region code of the database. Possible values: "RD", "DR", "HA", "HS", "HY", "CH", "CF", "CA", "CL", "SD", "PS", "SR" as character. Default = NULL.

dbYear

Two-digit year of the data being saved. Based on July 1st reference date, as character. Default = NULL.

Author(s)

Sebastien Lavoie (formerly, BC Stats)

See Also

Overall package documentation: dbutils()

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

Examples

getDBPath(dbType = "estimates", dbRegion = "CA", dbYear = "17")  ## "//.../POPCAE17.csv"
getDBPath(dbType = "births", dbRegion = "RD", dbYear = "18")     ## "//.../BIRRD18.csv"

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