plotSeasonality: Seasonality line graph

Description Usage Arguments See Also Examples

View source: R/AER_seasonality_graph.R

Description

This function draws a line graph describing the seasonality of the selected disease over the past 5 years.
The graph includes the distribution of cases, by month, over the past five years, with:

Expects aggregated data and pre-calculated min, max and mean figures.

Usage

1
2
3
4
5
6
7
8
9
plotSeasonality(
  .data,
  xvar = "TimeCode",
  yvar = "N",
  min4years = "Min4Years",
  max4years = "Max4Years",
  mean4years = "Mean4Years",
  year = 2016
)

Arguments

.data

dataframe containing the variables to plot

xvar

character string, name of the time variable on the x-axis in quotes (default "TimeCode")

yvar

character string, name of the variable to plot on the y-axis in quotes (default "N"), number of cases by month in the reference year (green solid line)

min4years

character string, name of the variable to plot in quotes including the minimum number of cases by month over the past 4 years (default "Min4Years")

max4years

character string, name of the variable to plot in quotes including the maximum number of cases by month over the past 4 years (default "Max4Years")

mean4years

character string, name of the variable to plot in quotes including the mean of the number of cases by month over the past 4 years (default "Mean4Years")

year

numeric, year to produce the graph for (default 2016).

See Also

Global function: getSeason
Required Packages: ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# --- Plot using external dataset

# Create a dummy dataset
test <- data.frame(Time = as.Date(paste0("2019-",c(1:12), "-01")),
                   N = sample(c(5000:7000), 12),
                   mean = sample(c(4000:5000), 12),
                   low = sample(c(3000:4000), 12),
                   high = sample(c(5000:6000), 12))

# Plot the dummy data
plotSeasonality(test,
                xvar = "Time",
                yvar = "N",
                min4years = "low",
                max4years = "high",
                mean4years = "mean",
                year = 2019)

# --- Please see examples in the vignette
browseVignettes(package = "EpiReport")

# --- Plot using the default dataset
getSeason()

EU-ECDC/EpiReport documentation built on Feb. 11, 2021, 6:30 p.m.