plotTS12MAvg: Time series with 12-month moving average

Description Usage Arguments See Also Examples

View source: R/AER_trend_graph.R

Description

This function draws a line graph describing the trend of the selected disease over the past 5 years.
The graph includes the trend and number of cases at EU/EEA level, by month, over the past five years, with:

Expects aggregated data and pre-calculated 12-month moving average.

Usage

1
plotTS12MAvg(.data, xvar = "TimeCode", yvar = "N", movAverage = "MAV")

Arguments

.data

dataframe containing the variables to plot

xvar

character string, name of the time variable to plot 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 over the 5-year period (grey solid line)

movAverage

character string, name of the variable to plot in quotes including the moving average per each time unit (default "MAV")

See Also

Global function: getTrend
Required Packages: ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# --- Plot using external dataset

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

# Plot the dummy data
plotTS12MAvg(test,
             xvar = "Time",
             yvar = "N",
             movAverage = "mean")

EpiReport documentation built on July 5, 2021, 5:06 p.m.