| render_report | R Documentation |
The render_report function is called once for each report to be created. render_report_safely
wraps render_report in purrr::safely.
render_report(
p_df = filter_report(df = RUBer::df_example, report_nr = 6L),
p_df_stg = NULL,
report_nr = 6L,
rmd_template = fs::path_package(package = "RUBer", "rmarkdown", "templates",
"datenreport-2022", "skeleton", "skeleton.Rmd"),
output_directory = fs::path_temp(),
output_filename = fs::path_file(fs::file_temp(pattern = "RUBer_report_", ext =
".docx")),
title = "Title",
author = "Author",
date = format(Sys.Date(), format = "%B %Y"),
font_file = "RubFlama-Regular.ttf",
path_figure_template = fs::file_temp(pattern = "figure_template_", ext = ".Rmd"),
post_process = TRUE,
quiet = FALSE
)
render_report_safely(...)
p_df |
Data frame containing the data for all reports |
p_df_stg |
Optional data frame with information on cases |
report_nr |
Report number of the report |
rmd_template |
Path to the R Markdown File for that report, defaults to Datenreport 2022 template from RUBer package |
output_directory |
Output directory for the rendered report, defaults to
|
output_filename |
Output filename for the rendered report, defaults to
|
title |
Character, title for the title page |
author |
Character, author for the title page |
date |
Date of the report displayed on the title page, defaults to
|
font_file |
Character, font file to use in all plots, defaults to "RubFlama-Regular.ttf" |
path_figure_template |
Character, file path to write the dynamically generated figure chunks
to file (useful for debugging purposes). Defaults to
|
post_process |
Boolean, whether |
quiet |
An option to suppress printing during rendering from knitr, pandoc command line and
others. Passed on to |
... |
Arguments passed on to |
Invisibly returns p_df
# Check if pandoc is available in the minimum required version
pandoc_available <- rmarkdown::pandoc_available(
version = "2.0",
error = FALSE
)
if(pandoc_available){
# Get paths for skeleton.Rmd
skeleton_location <- fs::path_package(
package = "RUBer",
"rmarkdown",
"templates",
"datenreport-2022",
"skeleton",
"skeleton.Rmd"
)
# Session based output directory
output_directory <- fs::path_temp()
# File name for the report output file
output_filename <- fs::path_file(
fs::file_temp(
pattern = "RUBer_report_",
ext = ".docx"
)
)
# Full path to output file
path_report_docx <- fs::path(
output_directory,
output_filename
)
# Create output directory
fs::dir_create(
output_directory
)
# Copy all files in the skeleton folder to the output directory
fs::file_copy(
path = fs::dir_ls(
fs::path_dir(
skeleton_location
)
),
new_path = output_directory
)
# Render the report in the temporary output directory
render_report(
rmd_template = skeleton_location,
output_directory = output_directory,
output_filename = output_filename
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.