Description Usage Arguments See Also Examples
View source: R/AER_trend_graph.R
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:
yvar
: The number of cases by month over the 5-year period (grey solid line)
movAverage
: The 12-month moving average of the number of cases by month (green solid line)
Expects aggregated data and pre-calculated 12-month moving average.
1 | plotTS12MAvg(.data, xvar = "TimeCode", yvar = "N", movAverage = "MAV")
|
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the time variable to plot on the x-axis
in quotes (default |
yvar |
character string, name of the variable to plot on the y-axis in quotes
(default |
movAverage |
character string, name of the variable to plot in quotes including
the moving average per each time unit (default |
Global function: getTrend
Required Packages: ggplot2
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.