You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use the data, we must format the data to have two columns:
117
117
118
118
+`date`: the date (as a date object see `?is.Date()`),
119
-
+`confirm`: number of confirmed cases on that date.
119
+
+`confirm`: number of disease reports (confirm) on that date.
120
120
121
121
Let's use `{tidyr}` and `{incidence2}` for this:
122
122
123
123
```{r, warning = FALSE, message = FALSE}
124
124
cases <- incidence2::covidregionaldataUK %>%
125
-
# use {tidyr} to preprocess missing values
125
+
# Preprocess missing values
126
126
tidyr::replace_na(base::list(cases_new = 0)) %>%
127
-
# use {incidence2} to compute the daily incidence
127
+
# Compute the daily incidence
128
128
incidence2::incidence(
129
129
date_index = "date",
130
130
counts = "cases_new",
131
131
count_values_to = "confirm",
132
132
date_names_to = "date",
133
133
complete_dates = TRUE
134
134
) %>%
135
-
# drop one column to adapt {EpiNow2} input
135
+
# Drop column for {EpiNow2} input format
136
136
dplyr::select(-count_variable) %>%
137
-
# keep the first 90 dates and visualize epicurve
137
+
# Keep the first 90 dates
138
138
dplyr::slice_head(n = 90)
139
+
140
+
cases
139
141
```
140
142
141
143
With `incidence2::incidence()` we aggregate cases in different time *intervals* (i.e., days, weeks or months) or per *group* categories. Also we can have complete dates for all the range of dates per group category using `complete_dates = TRUE`
@@ -506,7 +508,7 @@ The outbreak data of the start of the COVID-19 pandemic from the United Kingdom
506
508
507
509
+`date`: the date,
508
510
+`region`: the region,
509
-
+`confirm`: number of confirmed cases for a region on a given date.
511
+
+`confirm`: number of disease reports (confirm) for a region on a given date.
510
512
511
513
Generate regional Rt estimates from the `incidence2::covidregionaldataUK` data frame by:
0 commit comments