| plotAgeGender | R Documentation |
(Discouraged function. Please use plotBarGrouped() instead.)
plotAgeGender( .data, xvar = "XLabel", yvar = "ZValue", group = "YLabel", fill_color1 = "#65B32E", fill_color2 = "#7CBDC4", ytitle = "Rate" )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the 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 |
group |
character string, name of the grouping variable in quotes, e.g. gender.
(default |
fill_color1 |
character string, hexadecimal colour to use in the graph for bar 1;
(default to ECDC green |
fill_color2 |
character string, hexadecimal colour to use in the graph for bar 2;
(default to ECDC blue |
ytitle |
character string, y-axis title; (default |
This function draws a bar graph of the distribution of cases by age group
and gender (or possibly other grouping).
The bar graph presents the distribution of cases at EU/EEA level using either:
AG-COUNT: The number of cases by age and gender
AG-RATE: The rate per 100 000 cases by age and gender
AG-PROP: The proportion of cases by age and gender
Expects aggregated data.
Global function: getAgeGender
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data
mydat <- data.frame(Gender=c("F", "F", "M", "M"),
AgeGroup = c("0-65", "65+", "0-65", "65+"),
NumberOfCases = c(54,43,32,41))
# --- Plot the dummy data
plotAgeGender(mydat,
xvar = "AgeGroup",
yvar = "NumberOfCases",
group = "Gender",
ytitle = "Number of cases")