R/cansim.R
normalize_cansim_values.Rd
Facilitates working with Statistics Canada data table values retrieved using the package by setting all units to counts/dollars instead of millions, etc. If "replacement_value" is not set, it will replace the VALUE
field with normalized values and drop the scale
column. Otherwise it will keep the scale columns and create a new column named replacement_value with the normalized value. It will attempt to parse the REF_DATE
field and create an R date variable. This is currently experimental.
normalize_cansim_values(
data,
replacement_value = NA,
normalize_percent = TRUE,
default_month = "01",
default_day = "01",
factors = FALSE,
strip_classification_code = FALSE,
cansimTableNumber = NULL
)
A retrieved data table as returned from get_cansim()
pr get_cansim_ndm()
(Optional) the name of the column the manipulated value should be returned in. Defaults to replacing the current value field
(Optional) When true
(the default) normalizes percentages by changing them to rates
The default month that should be used when creating Date objects for annual data (default set to "01")
The default day of the month that should be used when creating Date objects for monthly data (default set to "01")
(Optional) Logical value indicating if dimensions should be converted to factors. (Default set to false
).
(strip_classification_code) Logical value indicating if classification code should be stripped from names. (Default set to false
).
(Optional) Only needed when operating on results of SQLite connections.
Returns the input tibble with with adjusted values
if (FALSE) {
cansim_table <- get_cansim("34-10-0013")
normalize_cansim_values(cansim_table)
}