Runs a GET request of vaccination data from the COVID-19 tracker API, and
returns parsed data.
Data may be returned as type
= "summary" (the most recent data) or
type
= "reports" (day-to-day reports).
Via the split
argument, data may be "overall" (all provinces/territories
combined), by "province", or by "region".
Alternatively, provide one or more two-letter codes (e.g. "AB") to province
to return reports for specific provinces, or one or more numeric region
codes (e.g. "1204") to return specific health regions.
Arguments
- type
One of "summary" (most recent data) or "reports" (day-to-day data).
- split
One of "overall", "province", or "region" to specify how the data is split. An "overall" summary or report gives cumulative numbers across Canada. Splitting by "province" returns data for all provinces/territories. Splitting by "region" is only available for "summary" data, and returns data for all health regions.
- province
One or more province/territory codes ("AB", "BC", "MB", "NB", "NL", "NS", "NT", "NU", "ON", "PE", "QC", "SK", "YT") to get reports. Upper, lower and mixed case strings are accepted.
- region
One or more health region IDs to get reports. Numeric and character values are accepted.
- fill_dates
When TRUE, the response fills in any missing dates with blank entries.
- stat
Returns only the specified statistics, e.g. "cases".
- date
Returns reports from only the specified date, in YYYY-MM-DD format.
- after
Returns reports from only on or after the specified date, in YYYY-MM-DD format.
- before
Returns reports from only on or before the specified date, in YYYY-MM-DD format.
Value
A data frame containing the vaccinations data. Includes
a province
variable if data is split by province, and a hr_uid
variable
if data is split by health region.
Examples
get_vaccination_data()
#> # A tibble: 1 × 12
#> last_updated latest_d…¹ chang…² chang…³ chang…⁴ chang…⁵ chang…⁶ total…⁷
#> <dttm> <date> <int> <int> <int> <int> <int> <int>
#> 1 2022-08-22 04:23:04 2022-08-22 55029 3680 8367 36044 0 8.82e7
#> # … with 4 more variables: total_vaccinated <int>, total_boosters_1 <int>,
#> # total_boosters_2 <int>, total_vaccines_distributed <int>, and abbreviated
#> # variable names ¹latest_date, ²change_vaccinations, ³change_vaccinated,
#> # ⁴change_boosters_1, ⁵change_boosters_2, ⁶change_vaccines_distributed,
#> # ⁷total_vaccinations
get_vaccination_data(split = "province")
#> # A tibble: 13 × 13
#> province last_updated date chang…¹ chang…² chang…³ chang…⁴ chang…⁵
#> <chr> <dttm> <chr> <int> <int> <int> <int> <int>
#> 1 ON 2022-08-22 04:23:04 2022-08… 24478 1485 2770 17141 0
#> 2 QC 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 3 NS 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 4 NB 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 5 MB 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 6 BC 2022-08-22 04:23:04 2022-08… 24243 1408 3991 12519 0
#> 7 PE 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 8 SK 2022-08-22 04:23:04 2022-08… 6308 787 1606 6384 0
#> 9 AB 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 10 NL 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 11 NT 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 12 YT 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> 13 NU 2022-08-22 04:23:04 2022-08… 0 0 0 0 0
#> # … with 5 more variables: total_vaccinations <int>, total_vaccinated <int>,
#> # total_boosters_1 <int>, total_boosters_2 <int>,
#> # total_vaccines_distributed <int>, and abbreviated variable names
#> # ¹change_vaccinations, ²change_vaccinated, ³change_boosters_1,
#> # ⁴change_boosters_2, ⁵change_vaccines_distributed
get_vaccination_data(type = "reports", split = "overall")
#> # A tibble: 938 × 12
#> last_updated date change_vacci…¹ chang…² chang…³ chang…⁴ chang…⁵
#> <dttm> <date> <int> <int> <int> <int> <int>
#> 1 2022-08-22 04:23:04 2020-01-25 0 0 0 0 0
#> 2 2022-08-22 04:23:04 2020-01-26 0 0 0 0 0
#> 3 2022-08-22 04:23:04 2020-01-27 0 0 0 0 0
#> 4 2022-08-22 04:23:04 2020-01-28 0 0 0 0 0
#> 5 2022-08-22 04:23:04 2020-01-29 0 0 0 0 0
#> 6 2022-08-22 04:23:04 2020-01-30 0 0 0 0 0
#> 7 2022-08-22 04:23:04 2020-01-31 0 0 0 0 0
#> 8 2022-08-22 04:23:04 2020-02-01 0 0 0 0 0
#> 9 2022-08-22 04:23:04 2020-02-02 0 0 0 0 0
#> 10 2022-08-22 04:23:04 2020-02-03 0 0 0 0 0
#> # … with 928 more rows, 5 more variables: total_vaccinations <int>,
#> # total_vaccinated <int>, total_boosters_1 <int>, total_boosters_2 <int>,
#> # total_vaccines_distributed <int>, and abbreviated variable names
#> # ¹change_vaccinations, ²change_vaccinated, ³change_boosters_1,
#> # ⁴change_boosters_2, ⁵change_vaccines_distributed
get_vaccination_data(type = "reports", split = "overall",
date = "2021-12-25")
#> # A tibble: 1 × 12
#> last_updated date chang…¹ chang…² chang…³ chang…⁴ chang…⁵ total…⁶
#> <dttm> <date> <int> <int> <int> <int> <int> <int>
#> 1 2022-08-22 04:23:04 2021-12-25 116846 5687 115453 395 0 6.73e7
#> # … with 4 more variables: total_vaccinated <int>, total_boosters_1 <int>,
#> # total_boosters_2 <int>, total_vaccines_distributed <int>, and abbreviated
#> # variable names ¹change_vaccinations, ²change_vaccinated,
#> # ³change_boosters_1, ⁴change_boosters_2, ⁵change_vaccines_distributed,
#> # ⁶total_vaccinations