Runs a GET request of vaccination data by age groups from the COVID-19
tracker API, and returns parsed data.
Via the split
argument, data may be "overall" (all provinces/territories
combined), or by "province".
Alternatively, provide one or more two-letter codes (e.g. "AB") to province
to return reports for specific provinces.
Usage
get_vaccine_age_groups(
split = c("overall", "province"),
province = NULL,
group = NULL,
before = NULL,
after = NULL
)
Arguments
- split
One of "overall", or "province" to specify how the data is split. An "overall" report gives cumulative numbers across Canada. Splitting by "province" returns all reports for all provinces/territories.
- 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.
- group
A specific age group to return, for example: "0-4", "05-11", "30-39", "80+", "not_reported"
- before
Returns reports from only on or before the specified date, in YYYY-MM-DD format.
- after
Returns reports from only on or after the specified date, in YYYY-MM-DD format.
Value
A data frame with, one row per age group per date. Includes
a province
variable if data is split by province.
Examples
get_vaccine_age_groups()
#> # A tibble: 668 × 6
#> date group_code full group partial atleast1
#> <date> <chr> <int> <chr> <int> <int>
#> 1 2020-12-19 80+ 0 80+ 335 335
#> 2 2020-12-19 0-15 0 0-15 0 0
#> 3 2020-12-19 16-69 0 16-69 11768 11768
#> 4 2020-12-19 70-74 0 70-74 174 174
#> 5 2020-12-19 75-79 0 75-79 85 85
#> 6 2020-12-19 unknown 0 Unknown 0 0
#> 7 2020-12-19 all_ages 0 All ages 12362 12362
#> 8 2020-12-19 not_reported 0 Not reported 0 0
#> 9 2020-12-26 80+ 0 80+ 2229 2229
#> 10 2020-12-26 0-15 0 0-15 5 5
#> # … with 658 more rows
get_vaccine_age_groups(split = "province")
#> # A tibble: 17,495 × 7
#> date group_code full group partial atleast1 province
#> <date> <chr> <int> <chr> <int> <int> <chr>
#> 1 2020-12-14 0-4 0 0-4 1 1 QC
#> 2 2020-12-14 80+ 0 80+ 169 169 QC
#> 3 2020-12-14 05-11 0 05-11 0 0 QC
#> 4 2020-12-14 12-17 0 12-17 0 0 QC
#> 5 2020-12-14 18-29 0 18-29 9 9 QC
#> 6 2020-12-14 30-39 0 30-39 11 11 QC
#> 7 2020-12-14 40-49 0 40-49 23 23 QC
#> 8 2020-12-14 50-59 0 50-59 22 22 QC
#> 9 2020-12-14 60-69 0 60-69 26 26 QC
#> 10 2020-12-14 70-79 0 70-79 35 35 QC
#> # … with 17,485 more rows
get_vaccine_age_groups(province = c("AB", "SK"))
#> # A tibble: 3,489 × 7
#> province date group_code full group partial atleast1
#> <chr> <date> <chr> <int> <chr> <int> <int>
#> 1 AB 2020-12-26 80+ 0 80+ 1 1
#> 2 AB 2020-12-26 0-15 0 0-15 0 0
#> 3 AB 2020-12-26 16-69 0 16-69 4765 4765
#> 4 AB 2020-12-26 70-74 0 70-74 22 22
#> 5 AB 2020-12-26 75-79 0 75-79 4 4
#> 6 AB 2020-12-26 unknown 0 Unknown 0 0
#> 7 AB 2020-12-26 all_ages 0 All ages 4792 4792
#> 8 AB 2020-12-26 not_reported 0 Not reported 0 0
#> 9 AB 2021-01-02 80+ 0 80+ 708 708
#> 10 AB 2021-01-02 0-15 0 0-15 0 0
#> # … with 3,479 more rows
get_vaccine_age_groups(province = "NS", group = "18-29")
#> # A tibble: 42 × 6
#> province date full group partial atleast1
#> <chr> <date> <int> <chr> <int> <int>
#> 1 NS 2021-04-17 3954 18-29 2459 6413
#> 2 NS 2021-04-24 4021 18-29 3592 7613
#> 3 NS 2021-05-01 4069 18-29 5192 9261
#> 4 NS 2021-05-08 4109 18-29 6276 10385
#> 5 NS 2021-05-15 4194 18-29 8023 12217
#> 6 NS 2021-05-22 4544 18-29 10800 15344
#> 7 NS 2021-05-29 4874 18-29 20669 25543
#> 8 NS 2021-06-05 4769 18-29 36129 40898
#> 9 NS 2021-06-12 5273 18-29 66881 72154
#> 10 NS 2021-06-19 6312 18-29 81947 88259
#> # … with 32 more rows
get_vaccine_age_groups(group = "80+", after = "2021-12-01")
#> # A tibble: 9 × 5
#> date full group partial atleast1
#> <date> <int> <chr> <int> <int>
#> 1 2021-12-04 1630884 80+ 28833 1659717
#> 2 2021-12-11 1633436 80+ 28621 1662057
#> 3 2021-12-18 1637238 80+ 28542 1665780
#> 4 2021-12-25 1640558 80+ 30717 1671275
#> 5 2022-01-01 1642929 80+ 30725 1673654
#> 6 2022-01-08 1647069 80+ 30588 1677657
#> 7 2022-01-15 1651274 80+ 30383 1681657
#> 8 2022-01-22 1655913 80+ 30342 1686255
#> 9 2022-01-30 1655401 80+ 30058 1685459