Retrieve data for a Statistics Canada data vector released within a given time frame

get_cansim_vector(vectors, start_time, end_time = Sys.time(),
  use_ref_date = TRUE)

Arguments

vectors

The list of vectors to retrieve

start_time

Starting date in YYYY-MM-DD format, applies to REF_DATE or releaseTime, depending on use_ref_date parameter

end_time

Set an optional end time filter in YYYY-MM-DD format (defaults to current system time)

use_ref_date

Optional, TRUE by default. When set to TRUE, uses REF_DATE of vector data to filter, otherwise it uses Statistics Canada's releaseDate value for filtering the specified vectors

Value

A tibble with data for vectors released between start and end time

Examples

get_cansim_vector("v41690973","2015-01-01")
#> # A tibble: 56 x 9 #> DECIMALS VALUE REF_DATE releaseTime SYMBOL frequencyCode SCALAR_ID COORDINATE #> <int> <dbl> <chr> <chr> <int> <int> <int> <chr> #> 1 1 124. 2015-01… 2018-06-12… 0 6 0 2.2.0.0.0… #> 2 1 125. 2015-02… 2018-06-12… 0 6 0 2.2.0.0.0… #> 3 1 126. 2015-03… 2018-06-12… 0 6 0 2.2.0.0.0… #> 4 1 126. 2015-04… 2018-06-12… 0 6 0 2.2.0.0.0… #> 5 1 127. 2015-05… 2018-06-12… 0 6 0 2.2.0.0.0… #> 6 1 127. 2015-06… 2018-06-12… 0 6 0 2.2.0.0.0… #> 7 1 127. 2015-07… 2018-06-12… 0 6 0 2.2.0.0.0… #> 8 1 127. 2015-08… 2018-06-12… 0 6 0 2.2.0.0.0… #> 9 1 127. 2015-09… 2018-06-12… 0 6 0 2.2.0.0.0… #> 10 1 127. 2015-10… 2018-06-12… 0 6 0 2.2.0.0.0… #> # … with 46 more rows, and 1 more variable: VECTOR <chr>