normalize_cansim_values: Normalize retrieved data table values to appropriate scales
Description
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.
Usage
normalize_cansim_values(data, replacement_value = NA,
normalize_percent = TRUE, default_month = "01", default_day = "01")
Arguments
data
A retrieved data table as returned from get_cansim()
pr get_cansim_ndm()
replacement_value
(Optional) the name of the column the manipulated value should be returned in. Defaults to replacing the current value field
normalize_percent
(Optional) When true
(the default) normalizes percentages by changing them to rates
default_month
The default month that should be used when creating Date objects for annual data (default set to "01")
default_day
The default day of the month that should be used when creating Date objects for monthly data (default set to "01")
Value
Returns the input tibble with with adjusted values
Examples
Run this code# NOT RUN {
cansim_table <- get_cansim("34-10-0013")
normalize_cansim_values(cansim_table)
# }
Run the code above in your browser using DataLab