Title: | Epidemiological Report |
---|---|
Description: | Drafting an epidemiological report in 'Microsoft Word' format for a given disease, similar to the Annual Epidemiological Reports published by the European Centre for Disease Prevention and Control. Through standalone functions, it is specifically designed to generate each disease specific output presented in these reports and includes: - Table with the distribution of cases by Member State over the last five years; - Seasonality plot with the distribution of cases at the European Union / European Economic Area level, by month, over the past five years; - Trend plot with the trend and number of cases at the European Union / European Economic Area level, by month, over the past five years; - Age and gender bar graph with the distribution of cases at the European Union / European Economic Area level. Two types of datasets can be used: - The default dataset of dengue 2015-2019 data; - Any dataset specified as described in the vignette. |
Authors: | Lore Merdrignac [aut, ctr, cre] (Author of the package and original code), Tommi Karki [aut, fnd], Esther Kissling [aut, ctr], Joana Gomes Dias [aut, fnd] (Project manager) |
Maintainer: | Lore Merdrignac <[email protected]> |
License: | EUPL |
Version: | 1.0.2 |
Built: | 2024-11-14 03:59:33 UTC |
Source: | https://github.com/cran/EpiReport |
A dataset describing the parameters to be used for each output of each disease report for all 53 health topics included in TESSy
AERparams
AERparams
A data frame with 53 rows (corresponding to the 53 health topics) and 24 variables:
Disease code that should match with the health topic code
from the disease-specific dataset e.g. ANTH
, SALM
, etc.
(optional) Disease group e.g. FWD
(optional) Disease programme e.g. FWD
Disease label to be used in the report e.g. salmonellosis, anthrax
(optional) Frequency of the disease e.g. VERY RARE
, NON-RARE
, etc.
Type of population presented for this disease i.e. ALL
or CONFIRMED
cases
Date of latest availability in the public access of the Atlas
Type of table to present in the report i.e. NO
table,
ASR
table presenting age-standardised rates, RATE
table presenting rates
or COUNT
table presenting the number of cases only.
Label to use in the table for rates e.g. RATE PER 100000 POPULATION
Number of decimals to use when presenting rates
Number of descimals to use when presenting ASR
Type of age and gender bar graph to present i.e. NO
graph,
AG-COUNT
Bar graph presenting the number of cases by age and gender,
AG-RATE
Bar graph presenting the rates of cases by age and gender,
AG-PROP
Bar graph presenting the proportion of cases by age and gender,
A-RATE
Bar graph presenting the rates of cases by age.
Label to use in the age and gender bar graph
Number of decimals to use when presenting rates in the age and gender bar graph
Logical Y/N specifying whether to include a line graph describing the trend of the disease over the time
Logical Y/N specifying whether to include a line graph describing the seasonality of the disease
Logical Y/N for specific line graph inclusion
Logical Y/N specifying whether to include the map presenting the number of cases by Member State
Logical Y/N specifying whether to include the map presenting the rates of cases by Member State
(optional) Number of decimals to use for presenting maps
Logical Y/N specifying whether to include the map presenting the age-standardised rates of cases by Member State
(optional) Number of decimals to use for presenting maps
Not implemented yet
Not implemented yet
Replace a plot at a bookmark location saving it as a PNG file in a temporary
folder.
A bookmark will be considered as valid if enclosing words within a paragraph;
i.e., a bookmark along two or more paragraphs is invalid,
a bookmark set on a whole paragraph is also invalid,
but bookmarking few words inside a paragraph is valid.
body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3)
body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3)
doc |
a docx device |
gg |
a ggplot object or any object that can be printed in grDevices::png() |
bookmark |
bookmark id |
width |
the width of the device in inches |
height |
the height of the device. |
doc
doc <- officer::read_docx(path = file.path(system.file(package = "EpiReport"), "template/AER_template.docx" )) p <- EpiReport::getTrend() doc <- EpiReport::body_replace_gg_at_bkm(doc = doc, gg = p, bookmark = "TS_TREND", width = 6, height = 3)
doc <- officer::read_docx(path = file.path(system.file(package = "EpiReport"), "template/AER_template.docx" )) p <- EpiReport::getTrend() doc <- EpiReport::body_replace_gg_at_bkm(doc = doc, gg = p, bookmark = "TS_TREND", width = 6, height = 3)
Cleaning the final table: identifying missing reports with '-'
,
replacing the Member State codes with Member State names (see correspondence
table MSCode
), identifying not reporting Member States with '.'
cleanECDCTable( x, Country = EpiReport::MSCode$Country, GeoCode = EpiReport::MSCode$GeoCode )
cleanECDCTable( x, Country = EpiReport::MSCode$Country, GeoCode = EpiReport::MSCode$GeoCode )
x |
dataframe, dataset to clean |
Country |
character vector, full names of the countries /
Member States (e.g. Austria, Belgium, etc.) that will replace the GeoCodes
included the x dataframe (Default |
GeoCode |
character vector, corresponding GeoCode of each Member State
(e.g. AT, BE, etc.) to replace with the country full names (Default |
cleaned ECDC dataframe
Global function: getTableByMS
Default dataset MSCode
Clean the MeasureCode variable and replace the specific codes with the generic ones
(e.g. ACCUTE.AGE_GENDER.RATE
will be replaced by CONFIRMED.AGE_GENDER.RATE
)
cleanMeasureCode(var)
cleanMeasureCode(var)
var |
character string vector variable, variable to clean |
ALL.COUNT
will replace the following codes:
ALL.DOMESTIC.COUNT
AGELT1.COUNT
ALL.RATE
will replace the following codes:
ALL.DOMESTIC.AGE.RATE
ALL.AGE.RATE
will replace the following codes:
ALL.DOMESTIC.AGE.RATE
ALL.AGESTANDARDISED.RATE
will replace the following codes:
ALL.DOMESTIC.AGESTANDARDISED.RATE
CONFIRMED.COUNT
will replace the following codes:
ALL.LABCONFIRMED.COUNT
CONFIRMED.LABCONFIRMED.COUNT
CONFIRMED.AGELT1.COUNT
TYPHOID.COUNT
CONFIRMED.RATE
will replace the following codes:
CONFIRMED.LABCONFIRMED.RATE
CONFIRMED.AGELT1.RATE
TYPHOID.RATE
CONFIRMED.AGESTANDARDISED.RATE
will replace the following codes:
CONFIRMED.LABCONFIRMED.AGESTANDARDISED.RATE
CONFIRMED.AGE_GENDER.RATE
will replace the following codes:
CONFIRMED.LABCONFIRMED.AGE_GENDER.RATE
TYPHOID.AGE_GENDER.RATE
ACCUTE.AGE_GENDER.RATE
cleaned vector variable
x <- EpiReport::SALM2016 x$MeasureCode <- cleanMeasureCode(x$MeasureCode)
x <- EpiReport::SALM2016 x$MeasureCode <- cleanMeasureCode(x$MeasureCode)
A dataset containing the data and indicators required to build the epidemiological report
for Dengue 2019 TESSy data (default dataset used throughout EpiReport
)
DENGUE2019
DENGUE2019
A data frame with 44,332 rows and 11 variables:
Disease code e.g. ANTH
, SALM
, etc.
Code of the measure indicator
Unit of the time variable i.e. Y
for yearly data or M
for monthly data
Time variable including dates in any formats available
(according to the unit defined in TimeUnit
) yearly data (e.g. 2001) or monthly data (e.g. 2001-01)
Geographical level in coded format including country names
(e.g. AT
for Austria, BE
for Belgium, BG
for Bulgaria,
see also the EpiReport::MSCode
table, correspondence table for Member State labels and codes)
XValue
The label associated with the x-axis in the epidemiological report
(see getAgeGender()
and plotAgeGender()
bar graph for the age variable)
The value associated with the y-axis in the epidemiological report
(see plotAge()
bar graph for the variable age, or getTableByMS()
for the number of cases, rate or age-standardised rate in the table by Member States by year)
The label associated with the y-axis in the epidemiological report
(see getAgeGender()
and plotAgeGender()
bar graph for the grouping variable gender)
The value associated with the stratification of XLabel and YLabel
in the age and gender bar graph (see getAgeGender()
and plotAgeGender()
)
Number of cases (see getTrend()
and getSeason()
line graph)
The correspondence table for Member State labels and codes MSCode
and the functions mentioned above: getAgeGender
,
plotAgeGender
, plotAge
, getTableByMS
,
getTrend
and getSeason
.
Full document: European Centre for Disease Prevention and Control. Guidelines for presentation of surveillance data. Stockholm: ECDC; 2018. Available from: Guidelines for presentation of surveillance data
EcdcColors(col_scale = "green", n = NULL, grey_shade = NULL, hot_cols = NULL)
EcdcColors(col_scale = "green", n = NULL, grey_shade = NULL, hot_cols = NULL)
col_scale |
Selected colour scale, defaults to 'green'. Select from 'green', 'blue', 'red', 'grey', 'qual(itative)' or 'hot(cold)' |
n |
Number of colours from each colour scale, apart from grey, in order indicated in the guidelines. Defaults to one colour, apart from two colours for the hotcold scale, max 7-8 colours for each scale. To select grey shades, use the argument grey_shade; to select number of hot (warm) colours in the hotcold scale, use the argument hot_cols. |
grey_shade |
(Optional: use only for 'grey') Selected shade(s) of grey in selected order; c('light', 'mediumlight','medium','mediumdark','dark'). Overrides given number of colours (n). Defaults to 'medium'. |
hot_cols |
(Optional: use only for 'hotcold') Selected number of hot (warm) colours in the hotcold colour scale. Must be smaller than the total number of colours (n). Defaults to floored half of total hotcold colours. |
Tommi Karki
# Select three first green colours EcdcColors("green", n=3) # Select two first qualitative colours EcdcColors("qual", n=2) # Select seven red colours EcdcColors("red", n=7) EcdcColors("grey", grey_shade = c("mediumlight", "dark")) # Use in a graph # Dummy data mydat <- data.frame(ID = c(seq(1,10,1)), Gender = c(rep(c("F", "M"),5))) barplot(table(mydat$Gender), col = EcdcColors(col_scale = "qual", n=2)) # Hot-cold colour scale barplot(c(1:4), col = EcdcColors(col_scale = "hotcold", n = 4, hot_cols = 2))
# Select three first green colours EcdcColors("green", n=3) # Select two first qualitative colours EcdcColors("qual", n=2) # Select seven red colours EcdcColors("red", n=7) EcdcColors("grey", grey_shade = c("mediumlight", "dark")) # Use in a graph # Dummy data mydat <- data.frame(ID = c(seq(1,10,1)), Gender = c(rep(c("F", "M"),5))) barplot(table(mydat$Gender), col = EcdcColors(col_scale = "qual", n=2)) # Hot-cold colour scale barplot(c(1:4), col = EcdcColors(col_scale = "hotcold", n = 4, hot_cols = 2))
Filter the table of parameters for the report on the given disease
filterDisease(dis, reportParameters)
filterDisease(dis, reportParameters)
dis |
character string, disease code |
reportParameters |
dataset of parameters for the report
(default |
dataframe with one row (from the AERparams
dataframe)
corresponding to the parameters of the selected disease
disease <- "SALM" reportParameters <- EpiReport::AERparams reportParameters <- filterDisease(disease, reportParameters)
disease <- "SALM" reportParameters <- EpiReport::AERparams reportParameters <- filterDisease(disease, reportParameters)
Function to generate the 'Microsoft Word' epidemiological report
(similar to the ECDC Annual Epidemiological Report (AER))
including all disease-specific outputs at each output-specific bookmarks exact location.
(for further information on the outputs and the corresponding bookmarks,
please see the package vignette "The Epidemiological Report Package" with browseVignettes("EpiReport")
)
(see ECDC AER https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getAER( template = file.path(system.file(package = "EpiReport"), "template/AER_template.docx"), outputPath = getwd(), x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, pathPNG = system.file("maps", package = "EpiReport") )
getAER( template = file.path(system.file(package = "EpiReport"), "template/AER_template.docx"), outputPath = getwd(), x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, pathPNG = system.file("maps", package = "EpiReport") )
template |
doc (see |
outputPath |
character string, the full path where to generate the epidemiological
report 'Word' output.
Default value is the current working directory |
x |
dataframe, raw disease-specific dataset (see specification of the dataset in the
package vignette with |
disease |
character string, disease code (default |
year |
numeric, year to produce the report for (default |
reportParameters |
dataframe, dataset including the required parameters for the report
production (default |
MSCode |
dataframe, correspondence table of GeoCode names and codes
(default |
pathPNG |
character string, the full path to the folder containing the maps (in PNG) to include in the final report |
A 'Word' document
Default template: getTemplate
Default datasets: MSCode
AERparams
SALM2016
DENGUE2019
Disease-specific outputs: getTableByMS
getSeason
getTrend
getMap
getAgeGender
## Not run: # --- Generating the AER report using the default Dengue dataset getAER() ## End(Not run) ## Not run: # --- Or using external data (example below) ZIKV2016 <- read.table("data/ZIKV2016.csv", sep = ",", header = TRUE, stringsAsFactors = FALSE) output <- "C:/EpiReport/doc/" pathMap <- "C:/EpiReport/maps/" getAER(disease = "ZIKV", year = 2016, x = ZIKV2016, outputPath = output, pathPNG = pathMap) ## End(Not run)
## Not run: # --- Generating the AER report using the default Dengue dataset getAER() ## End(Not run) ## Not run: # --- Or using external data (example below) ZIKV2016 <- read.table("data/ZIKV2016.csv", sep = ",", header = TRUE, stringsAsFactors = FALSE) output <- "C:/EpiReport/doc/" pathMap <- "C:/EpiReport/maps/" getAER(disease = "ZIKV", year = 2016, x = ZIKV2016, outputPath = output, pathPNG = pathMap) ## End(Not run)
Function returning the age and gender bar graph that will be included
in the epidemiological report at the bookmark location 'BARGPH_AGEGENDER'
of the template report.
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
A-RATE
: The rate per 100 000 cases by age only
The choice of the type of bar graph is set in the report parameters table AERparams
.
(see ECDC reports
https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getAgeGender( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, geoCode = "EU_EEA31", index = 1, doc )
getAgeGender( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, geoCode = "EU_EEA31", index = 1, doc )
x |
dataframe, raw disease-specific dataset (see specification of the
dataset in the package vignette with |
disease |
character string, disease code (default |
year |
numeric, year to produce the graph for (default |
reportParameters |
dataframe, dataset including the required parameters
for the graph and report production (default |
geoCode |
character string, GeoCode to run the analysis on
(default |
index |
integer, figure number |
doc |
'Word' document (see |
'Word' doc or a ggplot2 object
Global function for the full epidemilogical report: getAER
Required Packages: ggplot2
officer
Internal functions: plotBarGrouped
(use of plotAgeGender
discouraged)
plotBar
(use of plotAge
discouraged)
EcdcColors
Default datasets: AERparams
# --- Plot using the default dataset getAgeGender() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
# --- Plot using the default dataset getAgeGender() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
Function returning the disease-specific PNG map previously created
and stored in a specific folder (see pathPNG
argument) and
that will be included in the epidemiological report at the bookmark location
of the template report, depending of the type of map.
Three type of maps can be included in the report:
Bookmark 'MAP_NB'
: Distribution of cases by country.
An additional caption will be included at the location of the bookmark 'MAP_NB_CAPTION'
.
Bookmark 'MAP_RATE'
: Distribution of cases
per 100 000 population by country. An additional caption will be included
at the location of the bookmark 'MAP_RATE_CAPTION'
.
Bookmark 'MAP_ASR'
: Distribution of cases using
age-strandardised rates per 100 000 population by country.
An additional caption will be included at the location of the bookmark 'MAP_ASR_CAPTION'
.
(see ECDC reports https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getMap( disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, index = 1, pathPNG = system.file("maps", package = "EpiReport"), doc )
getMap( disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, index = 1, pathPNG = system.file("maps", package = "EpiReport"), doc )
disease |
character string, disease code (default |
year |
numeric, year to produce the map for (default |
reportParameters |
dataframe, dataset including the required parameters
for the map and report production (default |
index |
integer, figure number |
pathPNG |
character string, full path to the folder containing the maps in PNG
(default 'maps' folder included in the package |
doc |
'Word' document (see |
'Word' doc an image preview
Global function for the full epidemilogical report: getAER
Required Packages: officer
Internal functions: includeMap
previewMap
Default datasets: AERparams
# --- Preview of the PNG map using the default Dengue dataset getMap() # --- Plot using external PNG image # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
# --- Preview of the PNG map using the default Dengue dataset getMap() # --- Plot using external PNG image # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
Function returning the plot describing the seasonality of the disease
that will be included in the epidemiological report at the bookmark location
'TS_SEASON'
of the template report.
The graph includes the distribution of cases at EU/EEA level, by month,
over the past five years, with:
The number of cases by month in the reference year (green solid line)
The mean number of cases by month in the four previous years (grey dashed line)
The minimum number of cases by month in the four previous years (grey area)
The maximum number of cases by month in the four previous years (grey area)
(see ECDC reports https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getSeason( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
getSeason( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
x |
dataframe, raw disease-specific dataset (see specification of the
dataset in the package vignette with |
disease |
character string, disease code (default |
year |
numeric, year to produce the graph for (default |
reportParameters |
dataframe, dataset including the required parameters
for the graph and report production (default |
MSCode |
dataframe, correspondence table of GeoCode names and codes
(default |
index |
integer, figure number |
doc |
'Word' document (see |
'Word' doc or a ggplot2 object
Global function for the full epidemilogical report: getAER
Required Packages: ggplot2
officer
Internal functions: plotSeasonality
Default datasets: AERparams
MSCode
# --- Plot using the default dataset getSeason() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
# --- Plot using the default dataset getSeason() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
Function returning the table ('flextable'
) that will be included
in the epidemiological report at the bookmark location 'TABLE1'
of the template report. An additional caption will be included at the location
of the bookmark 'TABLE1_CAPTION'
.
(see Table 1 of the ECDC annual reports
https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getTableByMS( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
getTableByMS( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
x |
dataframe, raw disease-specific dataset (see specification of the dataset in the
package vignette with |
disease |
character string, disease code (default |
year |
numeric, year to produce the table for (default |
reportParameters |
dataframe, dataset including the required parameters for the report
production (default |
MSCode |
dataframe, correspondence table of GeoCode names and codes
(default |
index |
integer, figure number |
doc |
'Word' document (see |
The current version of the 'EpiReport'
package includes three types of table
(see detailed specification of the tables in the
package vignette with browseVignettes(package = "EpiReport")
):
COUNT
- Table presenting the number of cases by Member State (GeoCode) over a 5-year period;
RATE
- Table presenting the number of cases and rates by Member State (GeoCode) over a 5-year period;
ASR
- Table presenting the number of cases and rates by Member State (GeoCode) over a 5-year period,
including age-standardised rates for the most recent year.
'Word' doc or flextable
object (see 'flextable'
package)
Global function for the full epidemiological report: getAER
Required Packages: flextable
officer
Internal functions: shapeECDCFlexTable
cleanECDCTable
Default datasets: AERparams
MSCode
# --- Draft the table using the default Dengue dataset getTableByMS()
# --- Draft the table using the default Dengue dataset getTableByMS()
Function to export the generic 'Microsoft Word' empty template (included in
the 'EpiReport'
package) used to produce the
epidemiological report similar to the ECDC Annual Epidemiological Report (AER).
The modified version of the template can then be used to produce the final
epidemiological report using getAER(template = 'NewTemplate.docx', ...)
(see the package vignette "The Epidemiological Report Package" with
browseVignettes("EpiReport")
)
(see ECDC annual epidemilogical reports
https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getTemplate(output_path)
getTemplate(output_path)
output_path |
character string, the full path where to create the 'Word' output.
Defaut location will be the current working directory (default |
A 'Word' document
## Not run: # --- Export the template in the default folder: working directory getTemplate() # --- Or specify the full path getTemplate(output_path = getwd()) ## End(Not run)
## Not run: # --- Export the template in the default folder: working directory getTemplate() # --- Or specify the full path getTemplate(output_path = getwd()) ## End(Not run)
Function returning the plot describing the trend of the disease over time
that will be included in the epidemiological report at the bookmark location
'TS_TREND'
on the template report.
The graph includes the number of cases at EU/EEA level, by month,
over the past five years, with:
The number of cases by month over the 5-year period (grey solid line)
The 12-month moving average of the number of cases by month (green solid line)
(see ECDC reports https://www.ecdc.europa.eu/en/all-topics-z/surveillance-and-disease-data/annual-epidemiological-reports-aers)
getTrend( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
getTrend( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc )
x |
dataframe, raw disease-specific dataset (see specification of the
dataset in the package vignette with |
disease |
character string, disease code (default |
year |
numeric, year to produce the graph for (default |
reportParameters |
dataframe, dataset including the required parameters
for the graph and report production (default |
MSCode |
dataframe, correspondence table of GeoCode names and codes
(default |
index |
integer, figure number |
doc |
'Word' document (see |
'Word' doc or a ggplot2 preview
Global function for the full epidemilogical report: getAER
Required Packages: ggplot2
officer
Internal functions: plotTS12MAvg
Default datasets: AERparams
MSCode
# --- Plot using the default dataset getTrend() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
# --- Plot using the default dataset getTrend() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport")
Function including the disease-specific PNG map in the 'Word' document at the specific bookmark location.
includeMap( disease, year, reportParameters, index, pathPNG, doc, pop, namePNGsuffix, unit, mapBookmark, captionBookmark )
includeMap( disease, year, reportParameters, index, pathPNG, doc, pop, namePNGsuffix, unit, mapBookmark, captionBookmark )
disease |
character string, disease code (default |
year |
numeric, year to produce the graph for (default |
reportParameters |
dataframe, dataset including the required parameters
for the graph and report production (default |
index |
integer, figure number |
pathPNG |
character string, full path to the folder containing the maps in PNG
(default 'maps' folder included in the package |
doc |
'Word' document (see |
pop |
character string, label of the type of population to use in the caption
(e.g. |
namePNGsuffix |
character string, suffix of the PNG file name of the map
(i.e. |
unit |
character string, label of the unit used in the caption
(e.g. |
mapBookmark |
character string, label of the bookmark where to add the map in the 'Word' document |
captionBookmark |
character string, label of the bookmark where to add the caption in the 'Word' document |
'Word' doc
Global function: getMap
Dataframe providing the correspondence table of the geographical code GeoCode
used in the disease dataset, and the geographical label Country
to use
throughout the report. Additional information on the EU/EEA affiliation
is also available in column EUEEA
.
MSCode
MSCode
A data frame with 32 rows and 3 variables:
Full name of the country / Member State e.g. Austria, Belgium, etc.
Full name of the country / Member State including 'the' article for NL and UK e.g. Austria, Belgium, the Netherlands, the United Kingdom etc.
Associated code (see GeoCode
variable
on the SALM2016
internal dataset) e.g. AT, BE, BG, etc.
For each Member State, variable specifying in the country is part of the EU or EEA.
A function to order 'quasinumerical' (i.e. categorical with values such as "15-30" or "<18") integer vectors into increasing order. Currently handles away the following non-numerical characters "-", ">", "<", ">=", "<=", "+".
orderQuasinum(x)
orderQuasinum(x)
x |
character vector with 'quasinumerical' values |
Tommi Karki
Used in getAgeGender
and plotAgeGender
/ plotAge
age1 <- c("<1", "1-15", "16-25", ">65", "26-65") age2 <- c("0-4", "5-10", ">65", "25-64", "11-25") age3 <- c("5-10", ">65", "25-64", "11-25", "<=4") age4 <- c(">=65", "<18", "18-64") age5 <- c("5-10", "+65", "25-64", "11-25", "0-4") age1 orderQuasinum(age1) age2 orderQuasinum(age2) age3 orderQuasinum(age3) age4 orderQuasinum(age4) age5 orderQuasinum(age5)
age1 <- c("<1", "1-15", "16-25", ">65", "26-65") age2 <- c("0-4", "5-10", ">65", "25-64", "11-25") age3 <- c("5-10", ">65", "25-64", "11-25", "<=4") age4 <- c(">=65", "<18", "18-64") age5 <- c("5-10", "+65", "25-64", "11-25", "0-4") age1 orderQuasinum(age1) age2 orderQuasinum(age2) age3 orderQuasinum(age3) age4 orderQuasinum(age4) age5 orderQuasinum(age5)
(Discouraged function. Please use plotBarGrouped()
instead.)
plotAge( .data, xvar = "XLabel", yvar = "YValue", fill_color1 = "#65B32E", ytitle = "Rate" )
plotAge( .data, xvar = "XLabel", yvar = "YValue", fill_color1 = "#65B32E", 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 |
fill_color1 |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
ytitle |
character string, y-axis title; (default |
This function draws a bar graph by age group (or possibly other grouping).
The bar graph presents the distribution of cases at EU/EEA level
using the rate per 100 000 cases by age.
Expects aggregated data.
Global function: getAgeGender
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data mydat <- data.frame(AgeGroup = c("0-25", "26-65", "65+"), NumberOfCases = c(54,32,41)) # --- Plot the dummy data plotAge(mydat, xvar = "AgeGroup", yvar = "NumberOfCases", ytitle = "Number of cases")
# --- Create dummy data mydat <- data.frame(AgeGroup = c("0-25", "26-65", "65+"), NumberOfCases = c(54,32,41)) # --- Plot the dummy data plotAge(mydat, xvar = "AgeGroup", yvar = "NumberOfCases", ytitle = "Number of cases")
(Discouraged function. Please use plotBarGrouped()
instead.)
plotAgeGender( .data, xvar = "XLabel", yvar = "ZValue", group = "YLabel", fill_color1 = "#65B32E", fill_color2 = "#7CBDC4", ytitle = "Rate" )
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")
# --- 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")
This function draws a bar graph of the values of variable 'Yvar'
with the categorical variable 'Xvar' on the x-axis.
Expects aggregated data.
plotBar( .data, xvar = "XLabel", xlabel = "", yvar = "YValue", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1) )
plotBar( .data, xvar = "XLabel", xlabel = "", yvar = "YValue", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1) )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the variable to plot on the x-axis in quotes
(default |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the variable to plot on the y-axis in quotes
(default |
ylabel |
character string, label of the y axis |
fill_color |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
Global function: getAgeGender
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data mydat <- data.frame(AgeGroup = c("0-25", "26-65", "65+"), NumberOfCases = c(54,32,41)) # --- Plot the dummy data plotBar(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases")
# --- Create dummy data mydat <- data.frame(AgeGroup = c("0-25", "26-65", "65+"), NumberOfCases = c(54,32,41)) # --- Plot the dummy data plotBar(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases")
This function draws a vertical grouped bar graph of the values of variable 'Yvar'
with the categorical variable 'Xvar' on the x-axis and grouped by 'Group' categorical variable.
Expects aggregated data.
plotBarGrouped( .data, xvar = "XLabel", xlabel = "", yvar = "ZValue", ylabel = "", group = "YLabel", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), position = "dodge" )
plotBarGrouped( .data, xvar = "XLabel", xlabel = "", yvar = "ZValue", ylabel = "", group = "YLabel", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), position = "dodge" )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the variable to plot on the x-axis in quotes
(default |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the variable to plot on the y-axis in quotes
(default |
ylabel |
character string, label of the y axis |
group |
character string, name of the grouping variable in quotes, e.g. gender.
(default |
fill_color |
vector of character strings, hexadecimal colour to use in the graph for bars;
the vector should contain the number categories in |
position |
character string, position of the bars, either |
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(30, 35, 70, 65)) # --- Plot the dummy data plotBarGrouped(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases", group = "Gender") # -- Create dummy data mydat <- data.frame(VaccStatus = rep(c("Unvaccinated", "1 dose", "2 doses", "3 doses"), 3), AgeGroup = rep(c("<1", "1-4", "5-9") , each = 4), Proportion = c(90, 10, 0, 0, 30, 50, 20, 0, 10, 25, 35, 30)) mydat$VaccStatus <- factor(mydat$VaccStatus, levels = c("Unvaccinated", "1 dose", "2 doses", "3 doses")) plotBarGrouped(mydat, xvar = "AgeGroup", xlabel = "Age (years)", yvar = "Proportion", ylabel = "Proportion of cases %", group = "VaccStatus", position = "stack")
# --- Create dummy data mydat <- data.frame(Gender=c("F", "F", "M", "M"), AgeGroup = c("0-65", "65+", "0-65", "65+"), NumberOfCases = c(30, 35, 70, 65)) # --- Plot the dummy data plotBarGrouped(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases", group = "Gender") # -- Create dummy data mydat <- data.frame(VaccStatus = rep(c("Unvaccinated", "1 dose", "2 doses", "3 doses"), 3), AgeGroup = rep(c("<1", "1-4", "5-9") , each = 4), Proportion = c(90, 10, 0, 0, 30, 50, 20, 0, 10, 25, 35, 30)) mydat$VaccStatus <- factor(mydat$VaccStatus, levels = c("Unvaccinated", "1 dose", "2 doses", "3 doses")) plotBarGrouped(mydat, xvar = "AgeGroup", xlabel = "Age (years)", yvar = "Proportion", ylabel = "Proportion of cases %", group = "VaccStatus", position = "stack")
This function draws an horizontal bar graph of the values of variable 'Yvar'
with the categorical variable 'Xvar' on the x-axis.
Expects aggregated data.
plotBarGroupedH( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", group = "", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), log10_scale = FALSE )
plotBarGroupedH( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", group = "", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), log10_scale = FALSE )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the categorical variable to plot on the x-axis in quotes |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the numerical variable to plot on the y-axis in quotes |
ylabel |
character string, label of the y axis |
group |
character string, name of the grouping variable in quotes, e.g. gender. |
fill_color |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
log10_scale |
boolean, TRUE if y-axis should be log scale
(default |
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 plotBarGroupedH(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases", group = "Gender")
# --- 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 plotBarGroupedH(mydat, xvar = "AgeGroup", xlabel = "Age", yvar = "NumberOfCases", ylabel = "Number of cases", group = "Gender")
This function draws an horizontal bar graph of the values of variable 'Yvar'
with the categorical variable 'Xvar' on the x-axis.
Expects aggregated data.
plotBarH( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1), log10_scale = FALSE, xlabel_black = "" )
plotBarH( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1), log10_scale = FALSE, xlabel_black = "" )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the categorical variable to plot on the x-axis in quotes |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the numerical variable to plot on the y-axis in quotes |
ylabel |
character string, label of the y axis |
fill_color |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
log10_scale |
boolean, TRUE if y-axis should be log scale
(default |
xlabel_black |
(optional) character string, value of the categorical variable for which the bar should be black |
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data mfratio <- data.frame( Country = sample(EpiReport::MSCode$Country, 28), Ratio = runif(28, min = 0, max = 28)) # --- Plot the dummy data plotBarH(mfratio, xvar = "Country", xlabel = "", yvar = "Ratio", ylabel = "Male-to-Female ratio", log10_scale = FALSE) plotBarH(mfratio, xvar = "Country", xlabel = "", yvar = "Ratio", ylabel = "Male-to-Female ratio", log10_scale = TRUE, xlabel_black = "EU-EEA")
# --- Create dummy data mfratio <- data.frame( Country = sample(EpiReport::MSCode$Country, 28), Ratio = runif(28, min = 0, max = 28)) # --- Plot the dummy data plotBarH(mfratio, xvar = "Country", xlabel = "", yvar = "Ratio", ylabel = "Male-to-Female ratio", log10_scale = FALSE) plotBarH(mfratio, xvar = "Country", xlabel = "", yvar = "Ratio", ylabel = "Male-to-Female ratio", log10_scale = TRUE, xlabel_black = "EU-EEA")
This function draws a pie chart of the values of variable 'Xvar'
with the labels from the categorical variable 'Labels'.
Expects aggregated data.
plotPie( .data, xvar = "", labels = "", fill_colors = EcdcColors(col_scale = "qual", n = nrow(.data)) )
plotPie( .data, xvar = "", labels = "", fill_colors = EcdcColors(col_scale = "qual", n = nrow(.data)) )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the numerical variable to plot in quotes |
labels |
character string, name of the character variable including the corresponding labels |
fill_colors |
vector of character strings, hexadecimal colours
to use for each labels in the piechart; the vector should contain
the exact number of categories defined in |
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data piechart <- data.frame(Labels = c("Heterosexual females", "Heterosexual males", "MSM", "Unknow"), Values = c(1633,2937,15342,2854)) # --- Plot the dummy data plotPie(piechart, xvar = "Values", labels = "Labels")
# --- Create dummy data piechart <- data.frame(Labels = c("Heterosexual females", "Heterosexual males", "MSM", "Unknow"), Values = c(1633,2937,15342,2854)) # --- Plot the dummy data plotPie(piechart, xvar = "Values", labels = "Labels")
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.
plotSeasonality( .data, xvar = "TimeCode", yvar = "N", min4years = "Min4Years", max4years = "Max4Years", mean4years = "Mean4Years", year = 2016 )
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
# --- 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()
# --- 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()
This function draws a time series of the values of variable 'Yvar'
with the time variable 'Xvar' on the x-axis.
Expects aggregated data.
plotTS( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1), log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year" )
plotTS( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1), log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year" )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the time variable (expects date format) to plot on the x-axis in quotes |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the numerical variable to plot on the y-axis in quotes |
ylabel |
character string, label of the y axis |
fill_color |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
log10_scale |
boolean, |
xvar_format |
character string, time format to use to plot the x-axis
( |
xvar_breaks |
character string, time unit to use to plot the x-axis between breaks
( |
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data mydat <- data.frame(TimeCode = seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), YValue = sample(1:500/10, 10)) # --- Plot the dummy data plotTS(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year")
# --- Create dummy data mydat <- data.frame(TimeCode = seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), YValue = sample(1:500/10, 10)) # --- Plot the dummy data plotTS(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year")
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.
plotTS12MAvg(.data, xvar = "TimeCode", yvar = "N", movAverage = "MAV")
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
# --- 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")
# --- 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")
This function draws a time series of the values of variable 'Yvar'
with the time variable 'Xvar' on the x-axis.
The categorical variable that specify the group of the observations
for which there will be one time series each.
Expects aggregated data.
plotTSGrouped( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", group = "", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year" )
plotTSGrouped( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", group = "", fill_color = EcdcColors(col_scale = "qual", n = length(unique(.data[[group]]))), log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year" )
.data |
dataframe containing the variables to plot |
xvar |
character string, name of the time variable (expects date format) to plot on the x-axis in quotes |
xlabel |
character string, label of the x axis |
yvar |
character string, name of the numerical variable to plot on the y-axis in quotes |
ylabel |
character string, label of the y axis |
group |
character string, name of the grouping variable in quotes, e.g. gender. |
fill_color |
character string, hexadecimal colour to use in the graph;
(default to ECDC green |
log10_scale |
boolean, |
xvar_format |
character string, time format to use to plot the x-axis
( |
xvar_breaks |
character string, time unit to use to plot the x-axis between breaks
( |
Internal function: EcdcColors
Required Packages: ggplot2
# --- Create dummy data mydat <- data.frame(TimeCode = seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), YValue = sample(1:79/10, 20), YLabel = rep(c("Acute", "Chronic"), each = 10)) # --- Plot the dummy data plotTSGrouped(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", group = "YLabel", log10_scale = TRUE, xvar_format = "%Y", xvar_breaks = "1 year") # --- Create dummy data mydat <- data.frame(TimeCode = rep(seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), 5), YValue = c(sample(1:50/10, 10), sample(1:100/10, 10), sample(1:300/10, 10), sample(1:400/10, 10), sample(1:500/10, 10)), YLabel = rep(c("United Kingdom", "France", "Spain", "Netherlands", "Belgium"), each = 10)) # --- Plot the dummy data plotTSGrouped(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", group = "YLabel", log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year")
# --- Create dummy data mydat <- data.frame(TimeCode = seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), YValue = sample(1:79/10, 20), YLabel = rep(c("Acute", "Chronic"), each = 10)) # --- Plot the dummy data plotTSGrouped(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", group = "YLabel", log10_scale = TRUE, xvar_format = "%Y", xvar_breaks = "1 year") # --- Create dummy data mydat <- data.frame(TimeCode = rep(seq(as.Date("2008/1/1"), as.Date("2017/1/1"), "years"), 5), YValue = c(sample(1:50/10, 10), sample(1:100/10, 10), sample(1:300/10, 10), sample(1:400/10, 10), sample(1:500/10, 10)), YLabel = rep(c("United Kingdom", "France", "Spain", "Netherlands", "Belgium"), each = 10)) # --- Plot the dummy data plotTSGrouped(mydat, xvar = "TimeCode", xlabel = "Year", yvar = "YValue", ylabel = "Rate per 100 000 population", group = "YLabel", log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year")
Function previewing the disease-specific PNG map
previewMap(disease, year, reportParameters, pathPNG, namePNGsuffix)
previewMap(disease, year, reportParameters, pathPNG, namePNGsuffix)
disease |
character string, disease code (default |
year |
numeric, year to produce the graph for (default |
reportParameters |
dataframe, dataset including the required parameters
for the graph and report production (default |
pathPNG |
character string, full path to the folder containing the maps in PNG
(default 'maps' folder included in the package |
namePNGsuffix |
character string, suffix of the PNG file name of the map
(i.e. |
Preview
Global function: getMap
A dataset containing the data and indicators required to build the epidemiological report
for Salmonellosis 2016 TESSy data (default dataset used throughout EpiReport
)
SALM2016
SALM2016
A data frame with 60,775 rows and 18 variables:
Disease code e.g. ANTH
, SALM
, etc.
optional) Label of the measure indicator
Population targeted by the measure indicator
Code of the measure indicator
(optional) Measure indicator ID
(optional) Type of measure indicator
Unit of the time variable i.e. Y
for yearly data or M
for monthly data
(optional) Geographical level e.g. 1, 2, etc
Time variable including dates in any formats available
(according to the unit defined in TimeUnit
) yearly data (e.g. 2001) or monthly data (e.g. 2001-01)
Geographical level in coded format including country names
(e.g. AT
for Austria, BE
for Belgium, BG
for Bulgaria,
see also the EpiReport::MSCode
table, correspondence table for Member State labels and codes)
(optional) XValue
The label associated with the x-axis in the epidemiological report
(see getAgeGender()
and plotAgeGender()
bar graph for the age variable)
The value associated with the y-axis in the epidemiological report
(see plotAge()
bar graph for the variable age, or getTableByMS()
for the number of cases, rate or age-standardised rate in the table by Member States by year)
The label associated with the y-axis in the epidemiological report
(see getAgeGender()
and plotAgeGender()
bar graph for the grouping variable gender)
The value associated with the stratification of XLabel and YLabel
in the age and gender bar graph (see getAgeGender()
and plotAgeGender()
)
Number of cases (see getTrend()
and getSeason()
line graph)
(optional)
(optional)
The correspondence table for Member State labels and codes MSCode
and the functions mentioned above: getAgeGender
,
plotAgeGender
, plotAge
, getTableByMS
,
getTrend
and getSeason
.
Shaping the final table including titles, adding background color, specifying font name and size.
shapeECDCFlexTable(ft, headers, fsize, fname, maincolor, lastbold)
shapeECDCFlexTable(ft, headers, fsize, fname, maincolor, lastbold)
ft |
flextable (see |
headers |
dataframe including the multiple headers to add to the flextable object.
Please note that the column |
fsize |
numeric, font to use (Default 7) |
fname |
character, font name (Default |
maincolor |
character string, hexadecimal code for the header background
color (Default |
lastbold |
bolean, last row in bold (Default |
flextable object (see flextable
package)
Global function: getTableByMS
Required package flextable
Capitalise the first letter of a character string in order to use it as title
toCapTitle(str)
toCapTitle(str)
str |
character string to capitalise as a title |
character string
my_title <- "number of salmonellosis cases by age group" toCapTitle(my_title)
my_title <- "number of salmonellosis cases by age group" toCapTitle(my_title)