plot_data_for: Plotting a Time Series of Cases, Deaths or Incidence

Description Usage Arguments Value Warning See Also Examples

Description

plot_data_for is used to plot the absolute number of cases, of deaths or of the 7-day-incidence of a region and a certain age group. The time period can be defined by the user. The function will plot the returns of get_data_for

Usage

1
2
3
4
5
6
7
8
plot_data_for(
  regions,
  ages = "all",
  from = "2020-01-01",
  to = Sys.Date(),
  type = "cases",
  smoothing = 0
)

Arguments

regions

A vector that either consists of strings (the names of German districts or the names of German states) or district ID's, or just "Germany" as a whole If this vector has more than one entry, the tibble contains the values of these regions separately.

ages

A vector of numbers specifying the desired age groups. The available age groups are "A00-A04","A05-A14","A15-A34","A35-A59","A60-A79" and "A80+". The numbers in ages are automatically assigned to the belonging age group and afterwards, the cases and deaths of of these age groups are added up.

from

A date that specifies the beginning of the time series

to

A date that specifies the end of the time series

type

A string specifying which time series is returned. Can be "sti" for the incidence or just "cases" / "deaths"

smoothing

A positive integer that defines the window size of the moving average. Thus, the plot will be smoother

Value

A plot that displays the wanted value for the desired regions during the defined period of time.

Warning

When specifying region and agegroup, the incidence will not be accurate because there is no population data for the age groups in each district and it will be estimated by the age distribution of Germany. Therefore, it is recommended to specify only one or the other

See Also

Other time series of cases, deaths or incidence: get_data_for()

Examples

1
2
3
4
5
6
plot_data_for(ages=c(3,55),regions="Sachsen",from="2021-01-05",to="2021-02-06")

plot_data_for(ages=32,regions=c(8221, "Hessen", "Germany"), type="sti")

## Not run: plot_time_series_for(ages=c(12,42),from="2020-05-02",to="2020-05-01"
#"from" must always be an earlier date than "to"

slausmeister/revolution documentation built on Dec. 23, 2021, 3:24 a.m.