Learn R Programming

cansim (version 0.3.7)

collect_and_normalize: collect data from connection and normalize cansim table output

Description

collect data from connection and normalize cansim table output

Usage

collect_and_normalize(
  connection,
  replacement_value = "val_norm",
  normalize_percent = TRUE,
  default_month = "07",
  default_day = "01",
  factors = FALSE,
  strip_classification_code = FALSE
)

Arguments

connection

connection to database

replacement_value

(Optional) the name of the column the manipulated value should be returned in. Defaults to adding the `val_norm` 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")

factors

(Optional) Logical value indicating if dimensions should be converted to factors. (Default set to false).

strip_classification_code

(strip_classification_code) Logical value indicating if classification code should be stripped from names. (Default set to false).

Value

a tibble with the normalized data

Examples

Run this code
# NOT RUN {
library(dplyr)

con <- get_cansim_sqlite("34-10-0013")
data <- con %>%
  filter(GEO=="Ontario") %>%
  collect_and_normalize()

disconnect_cansim_sqlite(con)
# }

Run the code above in your browser using DataLab