Data are pulled in from both Our World in Data (OWID) and European Centre for Disease Prevention and Control(ECDC) for countries in the European Union/European Economic Area(EU/EEA). See here for more information on where OWID hospitalization data comes from by country. See this document for more details on the ECDC data.
Value
Returns a data frame with n rows and 6 columns, including:
- id
character, ISO 3166-1 alpha-3 country code
- indicator
character, one of:
"Daily ICU occupancy" (OWID & ECDC)
"Daily ICU occupancy per million" (OWID)
"Daily hospital occupancy" (OWID & ECDC)
"Daily hospital occupancy per million" (OWID)
"Weekly new hospital admissions" (OWID)
"Weekly new hospital admissions per 100k" (ECDC)
"Weekly new hospital admissions per million" (OWID)
"Weekly new ICU admissions" (OWID)
"Weekly new ICU admissions per million" (OWID)
"Weekly new ICU admissions per 100k" (ECDC)
- source
character, ECDC or OWID, see details for more information.
- date
date of observation
- value
value of observation for each indicator
- carry_fwd_value
when data is missing for a given date, if there is a non-missing value for that indicator-source-country combination within the previous 14 days, this column is that value carried forward.
Examples
if (FALSE) {
# get the full hospital data
hospdata <- get_hospdata()
# get the most recent non-missing data for each indicator by country
# for a specific source
hospdata %>%
group_by(id, indicator, source) %>%
select(-carry_fwd_value) %>%
filter(!is.na(value),
source %in% "OWID") %>%
arrange(date) %>%
slice_max(order_by = date, n = 1) %>%
ungroup()
# to get in a wide format with indicators as columns
hospdata %>%
filter(source %in% "ECDC") %>%
select(-carry_fwd_value) %>%
tidyr::pivot_wider(names_from = indicator,
values_from = value)
}