plotTS12MAvg {EpiReport}R Documentation

Time series with 12-month moving average

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

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


# --- 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")


[Package EpiReport version 1.0.2 Index]