Description Usage Arguments See Also Examples
View source: R/AER_seasonality_graph.R
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:
yvar
: The number of cases by month in the reference year (green solid line)
mean4years
: The mean number of cases by month in the four previous years (grey dashed line)
min4years
: The minimum number of cases by month in the four previous years (grey area)
max4years
: The maximum number of cases by month in the four previous years (grey area)
Expects aggregated data and pre-calculated min, max and mean figures.
1 2 3 4 5 6 7 8 9 | plotSeasonality(
.data,
xvar = "TimeCode",
yvar = "N",
min4years = "Min4Years",
max4years = "Max4Years",
mean4years = "Mean4Years",
year = 2016
)
|
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the time variable on the x-axis in quotes
(default |
yvar |
character string, name of the variable to plot on the y-axis in quotes
(default |
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 |
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 |
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 |
year |
numeric, year to produce the graph for (default |
Global function: getSeason
Required Packages: ggplot2
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()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.