README.md

dbutils

Lifecycle:Maturing

dbutils is a package of utility functions for processing and modifying BC Stats’ population databases via four main categories:

About

The BC Stats Population section has historically depended on APL; the dbutils package is a conversion of the APL functions to R functions.

Database types include: population, deaths, births. Databases must have 7 columns: Year, Type, TypeID, Age, Male, Female, and Total. Each Year of data must have the same number of occurrences, and Years must be continuous (no year can be missing).

There are several naming conventions used with such data, where files are named DDDRRTYY:

For example, 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. (This was passed over from decades of BC Stats PEOPLE development limited to 2-digit codes.)

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("bcgov/dbutils")

Example

Here is a very simple example which shows you how to use the rounded function:

library(dbutils)

round(12.5)
#> [1] 12
## this gives 12, not necessarily what you might expect; hence, the rounded function

?rounded
#> starting httpd help server ... done

dbutils::rounded(12.5)
#> [1] 13

dbutils::rounded(3.14)
#> [1] 3


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