### getSeason examples Source: https://epiconcept-paris.github.io/EpiReport/reference/getSeason.html Example calls to getSeason: one using the default dataset and one showing how to browse the package vignette for external dataset examples. ```r # --- Plot using the default dataset getSeason() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` -------------------------------- ### getTemplate Examples Source: https://epiconcept-paris.github.io/EpiReport/reference/getTemplate.html Examples showing how to export the template to the current working directory or a specified path. Note that these examples are wrapped in a conditional block to prevent execution. ```R if (FALSE) { # \dontrun{ # --- Export the template in the default folder: working directory getTemplate() # --- Or specify the full path getTemplate(output_path = getwd()) } # } ``` -------------------------------- ### Examples of orderQuasinum Source: https://epiconcept-paris.github.io/EpiReport/reference/orderQuasinum.html Examples demonstrating how orderQuasinum sorts various quasinumerical character vectors. ```R 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 #> [1] "<1" "1-15" "16-25" ">65" "26-65" orderQuasinum(age1) #> [1] "<1" "1-15" "16-25" "26-65" ">65" age2 #> [1] "0-4" "5-10" ">65" "25-64" "11-25" orderQuasinum(age2) #> [1] "0-4" "5-10" "11-25" "25-64" ">65" age3 #> [1] "5-10" ">65" "25-64" "11-25" "<=4" orderQuasinum(age3) #> [1] "<=4" "5-10" "11-25" "25-64" ">65" age4 #> [1] ">=65" "<18" "18-64" orderQuasinum(age4) #> [1] "<18" "18-64" ">=65" age5 #> [1] "5-10" "+65" "25-64" "11-25" "0-4" orderQuasinum(age5) #> [1] "0-4" "5-10" "11-25" "25-64" "+65" ``` -------------------------------- ### getAgeGender examples Source: https://epiconcept-paris.github.io/EpiReport/reference/getAgeGender.html Examples showing how to generate a plot using the default dataset and how to access package vignettes for external dataset usage. ```R # --- Plot using the default dataset getAgeGender() # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` -------------------------------- ### plotTS example with dummy data Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTS.html Creates dummy data and plots it using plotTS. The example sets xvar to 'TimeCode', yvar to 'YValue', and uses yearly breaks and labels. ```R # --- 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") ``` -------------------------------- ### getMap example: preview default map Source: https://epiconcept-paris.github.io/EpiReport/reference/getMap.html Example showing how to preview the default Dengue map. The output is the file path to the generated PNG. Also demonstrates browsing the package vignette, which returns no vignettes found. ```r # --- Preview of the PNG map using the default Dengue dataset getMap() #> [1] "/home/runner/work/_temp/Library/EpiReport/maps/DENGUE_2019.ALL.COUNT.png" # --- Plot using external PNG image # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` -------------------------------- ### Create and plot dummy data with plotBar Source: https://epiconcept-paris.github.io/EpiReport/reference/plotBar.html An example demonstrating how to create a dataframe and visualize it using the plotBar function. ```R # --- 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") ``` -------------------------------- ### Example: Plot using external dataset Source: https://epiconcept-paris.github.io/EpiReport/reference/getTrend.html Shows how to browse vignettes for examples of using an external dataset. The output indicates that no vignettes are found by browseVignettes(package = "EpiReport"). ```r # --- Plot using external dataset # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` -------------------------------- ### plotPie example with dummy data Source: https://epiconcept-paris.github.io/EpiReport/reference/plotPie.html Example usage of plotPie. Creates a dummy data frame with labels and values, then plots it with plotPie, specifying xvar as "Values" and labels as "Labels". ```r # --- 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") ``` -------------------------------- ### Drafting a table with default settings Source: https://epiconcept-paris.github.io/EpiReport/reference/getTableByMS.html An example of calling getTableByMS using the default Dengue dataset. ```R # --- Draft the table using the default Dengue dataset getTableByMS() ``` -------------------------------- ### Example: plotting a dummy dataset with plotTS12MAvg Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTS12MAvg.html Creates a dummy dataset and plots it using plotTS12MAvg, specifying custom column names for time, cases, and moving average. ```r # --- 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") ``` -------------------------------- ### filterDisease example Source: https://epiconcept-paris.github.io/EpiReport/reference/filterDisease.html Example of filtering the AERparams dataset for the disease 'SALM' using filterDisease. ```r disease <- "SALM" reportParameters <- EpiReport::AERparams reportParameters <- filterDisease(disease, reportParameters) ``` -------------------------------- ### plotAgeGender example with dummy data Source: https://epiconcept-paris.github.io/EpiReport/reference/plotAgeGender.html Complete example that creates a dummy data frame and calls plotAgeGender with custom arguments. The data frame has Gender, AgeGroup, and NumberOfCases columns, and the plot uses AgeGroup on the x-axis, NumberOfCases on the y-axis, and Gender as the grouping variable. ```r # --- 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") ``` -------------------------------- ### Example usage of plotAge Source: https://epiconcept-paris.github.io/EpiReport/reference/plotAge.html Demonstrates creating a dummy dataframe and passing it to plotAge to generate a bar graph. ```R # --- 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") ``` -------------------------------- ### Example of replacing a plot at a bookmark Source: https://epiconcept-paris.github.io/EpiReport/reference/body_replace_gg_at_bkm.html Demonstrates how to read a template document, generate a trend plot, and replace a specific bookmark named 'TS_TREND' with that plot. ```R 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) ``` -------------------------------- ### Example: capitalise first letter of a title Source: https://epiconcept-paris.github.io/EpiReport/reference/toCapTitle.html Demonstrates using toCapTitle on a sample title string. The output shows the capitalised result. ```r my_title <- "number of salmonellosis cases by age group" toCapTitle(my_title) #> [1] "Number of salmonellosis cases by age group" ``` -------------------------------- ### plotBarH example with dummy data Source: https://epiconcept-paris.github.io/EpiReport/reference/plotBarH.html Creates dummy data and plots it with plotBarH, first with a linear scale and then with a log10 scale and a black bar for the 'EU-EEA' category. ```R # --- 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") ``` -------------------------------- ### Plot seasonality with external dataset Source: https://epiconcept-paris.github.io/EpiReport/reference/plotSeasonality.html Example demonstrating how to prepare a dummy dataframe and pass it to plotSeasonality to visualize custom seasonality data. ```R # --- 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) ``` -------------------------------- ### Plot using default dataset Source: https://epiconcept-paris.github.io/EpiReport/reference/plotSeasonality.html Example of generating a seasonality plot using the default dataset provided by the getSeason function. ```R # --- Plot using the default dataset getSeason() ``` -------------------------------- ### Example of cleaning MeasureCode Source: https://epiconcept-paris.github.io/EpiReport/reference/cleanMeasureCode.html Demonstrates applying the cleanMeasureCode function to the MeasureCode column of the SALM2016 dataset. ```R x <- EpiReport::SALM2016 x$MeasureCode <- cleanMeasureCode(x$MeasureCode) ``` -------------------------------- ### Create and plot dummy data with plotBarGroupedH Source: https://epiconcept-paris.github.io/EpiReport/reference/plotBarGroupedH.html An example demonstrating how to prepare a data frame and visualize it using the plotBarGroupedH function. ```R # --- 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") ``` -------------------------------- ### Example: Plot using default dataset Source: https://epiconcept-paris.github.io/EpiReport/reference/getTrend.html Calls getTrend with no arguments to use the default dataset DENGUE2019 and parameters. This produces a plot of the trend and number of cases by month. ```r # --- Plot using the default dataset getTrend() ``` -------------------------------- ### Example: plotBarGrouped with dummy data (dodge) Source: https://epiconcept-paris.github.io/EpiReport/reference/plotBarGrouped.html Creates a dummy data frame with Gender and AgeGroup, then plots a grouped bar graph with position 'dodge' (default). ```R # --- 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") ``` -------------------------------- ### Example: plotBarGrouped with dummy data (stack) Source: https://epiconcept-paris.github.io/EpiReport/reference/plotBarGrouped.html Creates a dummy data frame with VaccStatus and AgeGroup, then plots a stacked bar graph using position = "stack". ```R # -- 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") ``` -------------------------------- ### plotSeasonality Source: https://epiconcept-paris.github.io/EpiReport/reference/plotSeasonality.html Documentation for the plotSeasonality function, including usage, arguments, and examples. ```APIDOC ## plotSeasonality ### Description Draws a line graph describing the seasonality of the selected disease over the past 5 years, including the distribution of cases by month with the reference year (green solid line), the mean of the four previous years (grey dashed line), and the minimum and maximum of the four previous years (grey area). Expects aggregated data and pre-calculated min, max and mean figures. ### Usage ```r plotSeasonality( .data, xvar = "TimeCode", yvar = "N", min4years = "Min4Years", max4years = "Max4Years", mean4years = "Mean4Years", year = 2016 ) ``` ### Arguments - **.data** (dataframe) - Required - Dataframe containing the variables to plot. - **xvar** (character string) - Optional - Name of the time variable on the x-axis in quotes (default `"TimeCode"`). - **yvar** (character string) - Optional - Name of the variable to plot on the y-axis in quotes (default `"N"`), number of cases by month in the reference year (green solid line). - **min4years** (character string) - Optional - Name of the variable to plot in quotes including the minimum number of cases by month over the past 4 years (default `"Min4Years"`). - **max4years** (character string) - Optional - Name of the variable to plot in quotes including the maximum number of cases by month over the past 4 years (default `"Max4Years"`). - **mean4years** (character string) - Optional - Name of the variable to plot in quotes including the mean of the number of cases by month over the past 4 years (default `"Mean4Years"`). - **year** (numeric) - Optional - Year to produce the graph for (default `2016`). ### Examples ```r # --- 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") #> No vignettes found by browseVignettes(package = "EpiReport") # --- Plot using the default dataset getSeason() ``` ``` -------------------------------- ### Example: plotTSGrouped with multiple groups Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTSGrouped.html Creates dummy data with five groups (countries) and plots it with log10_scale = FALSE. The x-axis uses yearly labels and breaks. ```R # --- 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") ``` -------------------------------- ### Example: plotTSGrouped with log10 scale Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTSGrouped.html Creates dummy data with two groups (Acute and Chronic) and plots it with log10_scale = TRUE. The x-axis uses yearly labels and breaks. ```R # --- 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") ``` -------------------------------- ### Example: Generate AER report with default Dengue dataset Source: https://epiconcept-paris.github.io/EpiReport/reference/getAER.html Runs getAER() with all defaults to produce the report for Dengue 2019. Wrapped in if(FALSE) and \dontrun to prevent execution during package checks. ```r if (FALSE) { # \dontrun{ # --- Generating the AER report using the default Dengue dataset getAER() } # } ``` -------------------------------- ### Using EcdcColors in a barplot Source: https://epiconcept-paris.github.io/EpiReport/reference/EcdcColors.html Shows how to use the function to colour a barplot with qualitative colours and a hot-cold scale. Includes dummy data creation and two barplot examples. ```r # 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)) ``` -------------------------------- ### Selecting colours from ECDC palettes Source: https://epiconcept-paris.github.io/EpiReport/reference/EcdcColors.html Examples of selecting colours from different scales: green, qualitative, red, and grey. The output shows the hex colour codes returned by the function. ```r # Select three first green colours EcdcColors("green", n=3) #> [1] "#C9D971" "#65B32E" "#1A6E31" # Select two first qualitative colours EcdcColors("qual", n=2) #> [1] "#65B32E" "#7CBDC4" # Select seven red colours EcdcColors("red", n=7) #> [1] "#7C170F" "#A82D17" "#C34A17" "#CC6B21" "#DC9635" "#E9B855" "#F1D676" EcdcColors("grey", grey_shade = c("mediumlight", "dark")) #> [1] "#C7C7C7" "#3F3F3F" ``` -------------------------------- ### Example: Generate AER report with external ZIKV data Source: https://epiconcept-paris.github.io/EpiReport/reference/getAER.html Shows how to use external data and custom output/map paths. Reads a CSV, sets output and map directories, then calls getAER with disease='ZIKV', year=2016, and the custom data. Wrapped in if(FALSE) and \dontrun. ```r if (FALSE) { # \dontrun{ # --- 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) } # } ``` -------------------------------- ### getSeason function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/getSeason.html Shows the function signature and default arguments for getSeason. Use this to understand the parameters and their defaults. ```r getSeason( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc ) ``` -------------------------------- ### Download default Word template with getTemplate() Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html Download the default ECDC Microsoft Word template to a specified folder using getTemplate(). ```R getTemplate(output_path = "C:/EpiReport/template") ``` -------------------------------- ### Usage of orderQuasinum Source: https://epiconcept-paris.github.io/EpiReport/reference/orderQuasinum.html Basic syntax for calling the orderQuasinum function. ```R orderQuasinum(x) ``` -------------------------------- ### getTemplate Usage Source: https://epiconcept-paris.github.io/EpiReport/reference/getTemplate.html Basic syntax for calling the getTemplate function to export the template. ```R getTemplate(output_path) ``` -------------------------------- ### Use custom Word template with getAER() Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html After modifying and saving the downloaded template, pass its path to getAER() via the template argument. Ensure Word bookmarks are preserved. ```R getAER(template = "C:/EpiReport/template/New_AER_Template.docx", outputPath = "C:/EpiReport/doc/") ``` -------------------------------- ### plotPie Source: https://epiconcept-paris.github.io/EpiReport/reference/plotPie.html Draws a pie chart of the values of variable 'Xvar' with labels from the categorical variable 'Labels'. Expects aggregated data. ```APIDOC ## plotPie ### Description This function draws a pie chart of the values of variable 'Xvar' with the labels from the categorical variable 'Labels'. Expects aggregated data. ### Usage ```r plotPie( .data, xvar = "", labels = "", fill_colors = EcdcColors(col_scale = "qual", n = nrow(.data)) ) ``` ### Arguments - **.data** (dataframe) - Required - Dataframe containing the variables to plot. - **xvar** (character string) - Required - Name of the numerical variable to plot in quotes. - **labels** (character string) - Required - Name of the character variable including the corresponding labels. - **fill_colors** (vector of character strings) - Optional - Hexadecimal colours to use for each label in the piechart; the vector should contain the exact number of categories defined in the "labels" variable. Defaults to ECDC colors (see `EcdcColors(col_scale = "qual", n = nrow(.data))`). ### See also Internal function: `EcdcColors` Required Packages: `ggplot` ### Examples ```r # --- 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") ``` ``` -------------------------------- ### Generate default table by Member State with getTableByMS() Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html Calls EpiReport::getTableByMS() with no arguments to generate a flextable object using the internal Salmonellosis 2012-2016 data. The default output presents the number of confirmed cases and the corresponding rate for each year, with a focus on 2016 and age-standardised rates. ```R EpiReport::getTableByMS() ``` -------------------------------- ### Access package vignettes Source: https://epiconcept-paris.github.io/EpiReport/reference/plotSeasonality.html Command to open the vignettes for the EpiReport package. ```R # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` -------------------------------- ### toCapTitle function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/toCapTitle.html Shows the function signature for toCapTitle, which takes a character string and returns it with the first letter capitalised. ```r toCapTitle(str) ``` -------------------------------- ### includeMap(disease, year, reportParameters, index, pathPNG, doc, pop, namePNGsuffix, unit, mapBookmark, captionBookmark) Source: https://epiconcept-paris.github.io/EpiReport/reference/includemap.html Function including the disease-specific PNG map in the Word document at the specific bookmark location. It takes parameters for disease code, year, report parameters, figure index, path to PNG files, the Word document object, population label, PNG file suffix, unit label, and bookmark names for the map and caption. ```APIDOC ## includeMap(disease, year, reportParameters, index, pathPNG, doc, pop, namePNGsuffix, unit, mapBookmark, captionBookmark) ### Description Function including the disease-specific PNG map in the 'Word' document at the specific bookmark location. ### Usage includeMap(disease, year, reportParameters, index, pathPNG, doc, pop, namePNGsuffix, unit, mapBookmark, captionBookmark) ### Arguments - **disease** (character string) - Disease code (default "DENGUE"). - **year** (numeric) - Year to produce the graph for (default 2019). - **reportParameters** (dataframe) - Dataset including the required parameters for the graph and report production (default AERparams). - **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) - Word document in which to add the maps at the bookmark location. - **pop** (character string) - Label of the type of population to use in the caption (e.g. confirmed). - **namePNGsuffix** (character string) - Suffix of the PNG file name of the map (i.e. "COUNT", "RATE" or "AGESTANDARDISED"). - **unit** (character string) - Label of the unit used in the caption (e.g. "per 100 000 population"). - **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. ### Value 'Word' doc ### See also Global function: getMap ``` -------------------------------- ### body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3) Source: https://epiconcept-paris.github.io/EpiReport/reference/body_replace_gg_at_bkm.html Replaces a plot at a bookmark location in a docx document, saving the plot as a PNG file in a temporary folder. The bookmark must be valid, enclosing words within a paragraph. ```APIDOC ## body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3) ### Description Replaces a plot at a bookmark location in a docx document, saving the plot as a PNG file in a temporary folder. A bookmark is considered valid if it encloses words within a paragraph; bookmarks spanning multiple paragraphs or set on a whole paragraph are invalid. ### Usage ```r body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3) ``` ### Arguments - **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 (default: 6) - **height** - the height of the device (default: 3) ### Value Returns the modified docx device (doc). ### Examples ```r 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) ``` ``` -------------------------------- ### getTableByMS(x, disease, year, reportParameters, MSCode, index, doc) Source: https://epiconcept-paris.github.io/EpiReport/reference/getTableByMS.html Returns a table (flextable) for the epidemiological report at the bookmark location 'TABLE1' and optionally adds a caption at 'TABLE1_CAPTION'. The table shows the distribution of cases by Member State (GeoCode) for a specified disease and year. ```APIDOC ## getTableByMS(x, disease, year, reportParameters, MSCode, index, doc) ### Description Returns a table (flextable) for the epidemiological report at the bookmark location 'TABLE1' and optionally adds a caption at 'TABLE1_CAPTION'. The table shows the distribution of cases by Member State (GeoCode) for a specified disease and year. ### Usage ```r getTableByMS( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc ) ``` ### Arguments - **x** (dataframe) - Required - Raw disease-specific dataset (default DENGUE2019). - **disease** (character string) - Required - Disease code (default "DENGUE"). Must be included in the dataset x in the HealthTopicCode variable. - **year** (numeric) - Required - Year to produce the table for (default 2019). Must be included in the dataset x in the TimeCode variable. - **reportParameters** (dataframe) - Required - Dataset including required parameters for report production (default AERparams). - **MSCode** (dataframe) - Required - Correspondence table of GeoCode names and codes (default MSCode). - **index** (integer) - Required - Figure number. - **doc** (Word document) - Required - Word document (see officer package) in which to add the table at the bookmark location. If missing, returns the flextable table object. ### Value Returns a Word document or a flextable object (see flextable package). ### Details The current version of the EpiReport package includes three types of tables: - 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. ### Examples ```r # --- Draft the table using the default Dengue dataset getTableByMS() ``` ``` -------------------------------- ### orderQuasinum(x) Source: https://epiconcept-paris.github.io/EpiReport/reference/orderQuasinum.html Orders a character vector containing 'quasinumerical' values (e.g., '15-30', '<18') into increasing order. Handles non-numeric characters '-', '>', '<', '>=', '<=', '+'. ```APIDOC ## orderQuasinum(x) ### Description Orders a character vector with 'quasinumerical' values (e.g., '15-30', '<18') into increasing order. Handles non-numeric characters '-', '>', '<', '>=', '<=', '+'. ### Usage ```r orderQuasinum(x) ``` ### Arguments - **x** (character vector) - Required - A character vector with 'quasinumerical' values. ### Examples ```r age1 <- c("<1", "1-15", "16-25", ">65", "26-65") orderQuasinum(age1) #> [1] "<1" "1-15" "16-25" "26-65" ">65" age2 <- c("0-4", "5-10", ">65", "25-64", "11-25") orderQuasinum(age2) #> [1] "0-4" "5-10" "11-25" "25-64" ">65" age3 <- c("5-10", ">65", "25-64", "11-25", "<=4") orderQuasinum(age3) #> [1] "<=4" "5-10" "11-25" "25-64" ">65" age4 <- c(">=65", "<18", "18-64") orderQuasinum(age4) #> [1] "<18" "18-64" ">=65" age5 <- c("5-10", "+65", "25-64", "11-25", "0-4") orderQuasinum(age5) #> [1] "0-4" "5-10" "11-25" "25-64" "+65" ``` ### See Also Used in `getAgeGender` and `plotAgeGender` / `plotAge` ### Author Tommi Karki ``` -------------------------------- ### getTemplate(output_path) Source: https://epiconcept-paris.github.io/EpiReport/reference/getTemplate.html Exports the generic Microsoft Word empty template included in the EpiReport package to the specified output path. The exported template can be modified and used with getAER to produce the final epidemiological report. ```APIDOC ## getTemplate(output_path) ### Description 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', ...). ### Usage ```r getTemplate(output_path) ``` ### Arguments #### output_path - **output_path** (character string) - Required - The full path where to create the 'Word' output. Default location will be the current working directory (default getwd()). ### Value A 'Word' document ### See Also getAER ### Examples ```r if (FALSE) { # \dontrun{ # --- Export the template in the default folder: working directory getTemplate() # --- Or specify the full path getTemplate(output_path = getwd()) } # } ``` ``` -------------------------------- ### getMap function signature Source: https://epiconcept-paris.github.io/EpiReport/reference/getMap.html Shows the usage of the getMap function with its arguments. The function requires a disease code, year, report parameters, index, path to PNG maps, and a Word document object. If the document is missing, it returns a preview of the PNG image. ```r getMap( disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, index = 1, pathPNG = system.file("maps", package = "EpiReport"), doc ) ``` -------------------------------- ### Generate report with custom output path Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html Specify the full path to the output folder using the outputPath argument of getAER(). ```R output <- "C:/EpiReport/doc/" getAER(outputPath = output) ``` -------------------------------- ### plotAgeGender function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/plotAgeGender.html Shows the function signature and default arguments. Use this to understand the parameters and defaults, including xvar, yvar, group, fill colors, and ytitle. ```r plotAgeGender( .data, xvar = "XLabel", yvar = "ZValue", group = "YLabel", fill_color1 = "#65B32E", fill_color2 = "#7CBDC4", ytitle = "Rate" ) ``` -------------------------------- ### Usage of body_replace_gg_at_bkm Source: https://epiconcept-paris.github.io/EpiReport/reference/body_replace_gg_at_bkm.html The function signature for replacing a plot at a bookmark location. ```R body_replace_gg_at_bkm(doc, gg, bookmark, width = 6, height = 3) ``` -------------------------------- ### EcdcColors function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/EcdcColors.html Shows the function signature with its arguments: col_scale (default 'green'), n (number of colours), grey_shade (for grey scale), and hot_cols (for hotcold scale). ```r EcdcColors(col_scale = "green", n = NULL, grey_shade = NULL, hot_cols = NULL) ``` -------------------------------- ### Generate default report with getAER() Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html Call getAER() with no arguments to generate the Salmonellosis 2016 report in the current working directory (see getwd()). ```R getAER() ``` -------------------------------- ### plotTS12MAvg function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTS12MAvg.html Shows the function signature with default arguments for xvar, yvar, and movAverage. ```r plotTS12MAvg(.data, xvar = "TimeCode", yvar = "N", movAverage = "MAV") ``` -------------------------------- ### getAgeGender function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/getAgeGender.html Basic syntax for calling the getAgeGender function with its default parameters. ```R getAgeGender( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, geoCode = "EU_EEA31", index = 1, doc ) ``` -------------------------------- ### Generate table by Member State with external data using getTableByMS() Source: https://epiconcept-paris.github.io/EpiReport/articles/EpiReport_Vignette.html Reads external Zika virus data from a CSV file and passes it to EpiReport::getTableByMS() with disease = "ZIKV" and year = 2016. The function generates a flextable presenting the number of reported cases over the last five years by Member State. ```R ZIKV2016 <- read.table("data/ZIKV2016.csv", sep = ",", header = TRUE, stringsAsFactors = FALSE) EpiReport::getTableByMS(x = ZIKV2016, disease = "ZIKV", year = 2016) ``` -------------------------------- ### getMap(disease, year, reportParameters, index, pathPNG, doc) Source: https://epiconcept-paris.github.io/EpiReport/reference/getMap.html Returns a disease-specific PNG map for inclusion in an epidemiological report. The map is inserted at a bookmark location in a Word document, or a preview is returned if the doc argument is missing. ```APIDOC ## getMap(disease, year, reportParameters, index, pathPNG, doc) ### Description 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'. ### Usage ```r getMap( disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, index = 1, pathPNG = system.file("maps", package = "EpiReport"), doc ) ``` ### Arguments - **disease** (character string) - Required - disease code (default "DENGUE"). - **year** (numeric) - Required - year to produce the map for (default 2019). - **reportParameters** (dataframe) - Required - dataset including the required parameters for the map and report production (default AERparams). - **index** (integer) - Required - figure number. - **pathPNG** (character string) - Required - full path to the folder containing the maps in PNG (default 'maps' folder included in the package). - **doc** (Word document) - Optional - 'Word' document (see 'officer' package) in which to add the maps at the bookmark location. If doc is missing, getMap returns a preview of the PNG image. ### Value 'Word' doc an image preview ### Examples ```r # --- Preview of the PNG map using the default Dengue dataset getMap() #> [1] "/home/runner/work/_temp/Library/EpiReport/maps/DENGUE_2019.ALL.COUNT.png" # --- Plot using external PNG image # --- Please see examples in the vignette browseVignettes(package = "EpiReport") #> No vignettes found by browseVignettes(package = "EpiReport") ``` ``` -------------------------------- ### plotTS function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/plotTS.html Shows the function signature and default arguments for plotTS. Expects aggregated data with a date-formatted time variable and a numerical variable. ```R plotTS( .data, xvar = "", xlabel = "", yvar = "", ylabel = "", fill_color = EcdcColors(col_scale = "qual", n = 1), log10_scale = FALSE, xvar_format = "%Y", xvar_breaks = "1 year" ) ``` -------------------------------- ### getTableByMS function usage Source: https://epiconcept-paris.github.io/EpiReport/reference/getTableByMS.html The standard function signature for generating a disease-specific table. ```R getTableByMS( x = EpiReport::DENGUE2019, disease = "DENGUE", year = 2019, reportParameters = EpiReport::AERparams, MSCode = EpiReport::MSCode, index = 1, doc ) ``` -------------------------------- ### BibTeX Citation for EpiReport Source: https://epiconcept-paris.github.io/EpiReport/authors.html Use this BibTeX entry to cite the EpiReport package in academic or technical publications. ```BibTeX @Manual{, title = {EpiReport: Epidemiological Report}, author = {Lore Merdrignac and Tommi Karki and Esther Kissling and Joana {Gomes Dias}}, year = {2025}, note = {R package version 1.0.4}, url = {https://www.ecdc.europa.eu/en/publications-data/monitoring/all-annual-epidemiological-reports}, } ``` -------------------------------- ### shapeECDCFlexTable(ft, headers, fsize, fname, maincolor, lastbold) Source: https://epiconcept-paris.github.io/EpiReport/reference/shapeECDCFlexTable.html Shapes a flextable object into an ECDC table layout. It adds headers, sets font size and name, applies a background color to the header, and optionally makes the last row bold. ```APIDOC ## shapeECDCFlexTable(ft, headers, fsize, fname, maincolor, lastbold) ### Description Shapes a flextable object into an ECDC table layout. It adds headers, sets font size and name, applies a background color to the header, and optionally makes the last row bold. ### Usage ```r shapeECDCFlexTable(ft, headers, fsize, fname, maincolor, lastbold) ``` ### Arguments - **ft** (flextable) - Required - Table to shape into ECDC table layout. - **headers** (dataframe) - Required - Dataframe including the multiple headers to add to the flextable object. The column `col_keys` should contain the names of the flextable object (i.e. `col_key = names(x)`), accordingly to `set_header_df`. - **fsize** (numeric) - Optional - Font size to use (Default 7). - **fname** (character) - Optional - Font name (Default `"Tahoma"`). - **maincolor** (character string) - Optional - Hexadecimal code for the header background color (Default `EcdcColors(col_scale = "green", n=1)`). - **lastbold** (boolean) - Optional - Last row in bold (Default `TRUE`), usually used when the last row includes totals (EU/EEA totals). ### Value Returns a flextable object (see `flextable` package). ### See also Global function: `getTableByMS` Required package: `flextable` ```