View source: R/survstat-loader.R
| get_timeseries | R Documentation |
SurvStat web service.This function gets a weekly timeseries of disease count or incidence data
from the Robert Koch Institute SurvStat web service. The timeseries can be
stratified by any combination of age, geography, disease, disease subtype.
Queries to SurvStat are cached and paged, but obviously multidimensional
extracts have the potential to need a lot of downloading.
get_timeseries(
disease = NULL,
measure = c("Count", "Incidence"),
...,
age_group = NULL,
age_range = c(0, Inf),
disease_subtype = FALSE,
years = NULL,
geography = NULL,
trim_zeros = c("leading", "both", "none"),
.progress = TRUE
)
disease |
the disease of interest as a |
measure |
one of |
... |
not used, must be empty. |
age_group |
(optional) the age group of interest as a |
age_range |
(optional) a length 2 vector with the minimum and maximum ages to consider |
disease_subtype |
if |
years |
(optional) a vector of years to limit the response to. This may
be useful to limit the size of returned pages in the event the |
geography |
(optional) a geographical breakdown. This can be given as a
character where it must be one of |
trim_zeros |
get rid of zero counts. Either "both" (from start and end), "leading" (from start only - the default) or "none". |
.progress |
by default a progress bar is shown, which may be important
if many downloads are needed to fulfil the request. It can be disabled
by setting this to |
a data frame with at least date (weekly), and one of count or
incidence columns. Most likely it will also have disease_name and
disease_code columns, and some of age_name, age_code, age_low,
age_high, geo_code, geo_name, disease_subtype_code,
disease_subtype_name depending on options. The dataframe will be grouped
to make sure each group contains a single timeseries.
# age stratified
get_timeseries(
diseases$`COVID-19`,
measure = "Count",
age_group = age_groups$children_coarse
) %>% dplyr::glimpse()
# geographic
get_timeseries(
diseases$`COVID-19`,
measure = "Count",
geography = "state"
) %>% dplyr::glimpse()
# disease stratified, subset of years:
get_timeseries(
measure = "Count",
years = 2024
) %>% dplyr::glimpse()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.