Age and Gender bar graph
plotAgeGender.Rd
(Discouraged function. Please use plotBarGrouped()
instead.)
Usage
plotAgeGender(
.data,
xvar = "XLabel",
yvar = "ZValue",
group = "YLabel",
fill_color1 = "#65B32E",
fill_color2 = "#7CBDC4",
ytitle = "Rate"
)
Arguments
- .data
dataframe containing the variables to plot
- xvar
character string, name of the variable to plot on the x-axis in quotes (default
"XLabel"
)- yvar
character string, name of the variable to plot on the y-axis in quotes (default
"ZValue"
)- group
character string, name of the grouping variable in quotes, e.g. gender. (default
"YLabel"
)- fill_color1
character string, hexadecimal colour to use in the graph for bar 1; (default to ECDC green
"#65B32E"
, see EcdcColors(col_scale = "qual", n = 2))- fill_color2
character string, hexadecimal colour to use in the graph for bar 2; (default to ECDC blue
"#7CBDC4"
, see EcdcColors(col_scale = "qual", n = 2))- ytitle
character string, y-axis title; (default
"Rate"
).
Details
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 genderAG-RATE
: The rate per 100 000 cases by age and genderAG-PROP
: The proportion of cases by age and gender
Expects aggregated data.
See also
Global function: getAgeGender
Internal function: EcdcColors
Required Packages: ggplot
Examples
# --- 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")