Skip to contents

Runs a GET request of sub-region vaccination data from the COVID-19 tracker API, and returns parsed data. The dates argument specifies the time frame of the data: "current" (the default; latest report for each sub-region), "recent" (15 most recent reports for each sub-region), and "all" (returns all reports for one or more sub-regions specified by the subregion_code argument). To get a list of available sub-regions, use the function get_subregions().

Usage

get_subregion_vaccination_data(
  dates = c("current", "recent", "all"),
  subregion_code = NULL
)

Arguments

dates

One of "current", "recent", or "all" to specify the time frame of the reports returned. If choosing "all" reports, must also provide one or more sub-region codes.

subregion_code

One or more sub-region codes. Returns all reports for those sub-regions (even if dates is not "all")

Value

A data frame with one row per sub-region report.

Details

Note that sub-region vaccination data is only for select provinces and territories. Also the percentages reported differ between percent of total population, and percent of eligible population. See the API documentation for more details: https://api.covid19tracker.ca/docs/1.0/vaccinations.

Examples


get_subregion_vaccination_data()
#> # A tibble: 806 × 12
#>    last_updated        code  date       total_…¹ perce…² sourc…³ total…⁴ perce…⁵
#>    <dttm>              <chr> <chr>         <int>   <dbl> <chr>     <int>   <dbl>
#>  1 2022-08-21 20:17:07 SK001 2022-02-06    18733   0.700 total     16875   0.631
#>  2 2022-08-21 20:17:07 SK002 2022-02-06     1959   0.683 total      1706   0.595
#>  3 2022-08-21 20:17:07 SK003 2022-02-06    16606   0.751 total     14655   0.663
#>  4 2022-08-21 20:17:07 SK004 2022-02-06    66614   0.863 total     58628   0.760
#>  5 2022-08-21 20:17:07 SK005 2022-02-06    67900   0.792 total     63117   0.736
#>  6 2022-08-21 20:17:07 SK006 2022-02-06    32682   0.819 total     30866   0.774
#>  7 2022-08-21 20:17:07 SK007 2022-02-06   263867   0.771 total    249513   0.729
#>  8 2022-08-21 20:17:07 SK008 2022-02-06    27576   0.766 total     26220   0.728
#>  9 2022-08-21 20:17:07 SK009 2022-02-06    75858   0.791 total     72104   0.752
#> 10 2022-08-21 20:17:07 SK010 2022-02-06   221443   0.822 total    208970   0.776
#> # … with 796 more rows, 4 more variables: source_dose_2 <chr>,
#> #   total_dose_3 <int>, percent_dose_3 <dbl>, source_dose_3 <chr>, and
#> #   abbreviated variable names ¹​total_dose_1, ²​percent_dose_1, ³​source_dose_1,
#> #   ⁴​total_dose_2, ⁵​percent_dose_2
get_subregion_vaccination_data("recent")
#> # A tibble: 132 × 12
#>    last_updated        date       code  total_…¹ perce…² sourc…³ total…⁴ perce…⁵
#>    <dttm>              <chr>      <chr>    <int>   <dbl> <chr>     <int>   <dbl>
#>  1 2022-08-22 04:23:04 2022-08-17 AB001     4726   0.753 total      4528   0.721
#>  2 2022-08-22 04:23:04 2022-08-17 AB002     6611   0.792 total      6251   0.749
#>  3 2022-08-22 04:23:04 2022-08-17 AB003     4119   0.610 total      3917   0.580
#>  4 2022-08-22 04:23:04 2022-08-17 AB004    12524   0.755 total     11740   0.707
#>  5 2022-08-22 04:23:04 2022-08-17 AB005    15797   0.612 total     15026   0.582
#>  6 2022-08-22 04:23:04 2022-08-17 AB006     9939   0.522 total      9506   0.500
#>  7 2022-08-22 04:23:04 2022-08-17 AB007     7148   0.644 total      6700   0.603
#>  8 2022-08-22 04:23:04 2022-08-17 AB008     2871   0.448 total      2708   0.423
#>  9 2022-08-22 04:23:04 2022-08-17 AB009    19929   0.718 total     18860   0.680
#> 10 2022-08-22 04:23:04 2022-08-17 AB010     2300   0.660 total      2216   0.636
#> # … with 122 more rows, 4 more variables: source_dose_2 <chr>,
#> #   total_dose_3 <int>, percent_dose_3 <dbl>, source_dose_3 <chr>, and
#> #   abbreviated variable names ¹​total_dose_1, ²​percent_dose_1, ³​source_dose_1,
#> #   ⁴​total_dose_2, ⁵​percent_dose_2
get_subregion_vaccination_data("all", subregion_code = c("ON382", "SK007"))
#> # A tibble: 59 × 11
#>    sub_r…¹ date  total…² perce…³ sourc…⁴ total…⁵ perce…⁶ sourc…⁷ total…⁸ perce…⁹
#>    <chr>   <chr>   <int>   <dbl> <chr>     <int>   <dbl> <chr>     <int>   <dbl>
#>  1 ON382   2021…    9160   0.723 percent    8874   0.700 percent      NA NA     
#>  2 ON382   2021…    9594   0.757 percent    9047   0.714 percent     446  0.0352
#>  3 ON382   2022…    9899   0.781 percent    9480   0.748 percent    5722  0.452 
#>  4 SK007   2021…  239383   0.700 total    227727   0.666 total        NA NA     
#>  5 SK007   2021…  239445   0.700 total    227949   0.666 total        NA NA     
#>  6 SK007   2021…  239532   0.700 total    228094   0.667 total        NA NA     
#>  7 SK007   2021…  239653   0.701 total    228378   0.668 total        NA NA     
#>  8 SK007   2021…  239735   0.701 total    228557   0.668 total        NA NA     
#>  9 SK007   2021…  240053   0.702 total    229537   0.671 total        NA NA     
#> 10 SK007   2021…  240120   0.702 total    229745   0.672 total        NA NA     
#> # … with 49 more rows, 1 more variable: source_dose_3 <chr>, and abbreviated
#> #   variable names ¹​sub_region, ²​total_dose_1, ³​percent_dose_1, ⁴​source_dose_1,
#> #   ⁵​total_dose_2, ⁶​percent_dose_2, ⁷​source_dose_2, ⁸​total_dose_3,
#> #   ⁹​percent_dose_3