covid {cubble} | R Documentation |
Daily COVID count data (in tsibble
) and Victoria LGA (in sf
)
Description
Daily COVID count data (covid
) from 2022-01-01 to 2020-03-23 in a
tsibble object (date
, lga
, n
, and avg_7day
).
Victoria Local Government Area (LGA) spatial geometry in an sf object
(lga_name_2018
and geometry
)
Usage
covid
lga
Format
An object of class tbl_ts
(inherits from tbl_df
, tbl
, data.frame
) with 6806 rows and 4 columns.
An object of class sf
(inherits from data.frame
) with 80 rows and 2 columns.
Details
- date
date object, from 2022-01-01 to 2020-03-23
- lga
Victoria Local Government Area (LGA) in Australia
- n
COVID-19 case count
- avg_7day
rolling mean of
n
in a 7 day window. Calculate withmutate(avg_7day = slider::slide_dbl(n, mean, .before = 6))
- lga_name_2018
LGA encoding by Australia Bureau of Statistics, slightly differ from the encoding used by the Department of Health in the
covid
data- geometry
multipolygon geometry of each LGA
Examples
library(sf)
library(dplyr)
# prompt msg on the key mismatch between the two datasets
make_cubble(lga, covid, by = c("lga_name_2018" = "lga"))
check_res <- check_key(lga, covid, by = c("lga_name_2018" = "lga"))
# fix mismatch
lga2 <- lga |>
rename(lga = lga_name_2018) |>
mutate(lga = ifelse(lga == "Kingston (C) (Vic.)", "Kingston (C)", lga),
lga = ifelse(lga == "Latrobe (C) (Vic.)", "Latrobe (C)", lga)) |>
filter(!lga %in% check_res$others$spatial)
covid2 <- covid |> filter(!lga %in% check_res$others$temporal)
make_cubble(spatial = lga2, temporal = covid2)