Onkelinx, Thierry
123 Research Institute for Nature and Forest (INBO)45
keywords: corporate identity; quarto
Prepare new documents using the Flandersqmd extensions.
Installation
You can install the development version from GitHub with:
# install.packages("pak")
pak::pkg_install("inbo/flandersqmd")A stable version is available on r-universe:
install.packages("flandersqmd", repos = c("https://inbo.r-universe.dev", "https://cloud.r-project.org"))Example
Working on a book style report
A book style report provides a structure to write a report in a book style format. It is based on the quarto book format and uses the flandersqmd-book extension. The available output formats are pdf and html.
Though optional, we strongly recommend to create a checklist project first. For more information on how to create a checklist project, see the checklist package documentation.
library(checklist)
# Where to store the checklist project
path <- tempfile()
dir.create(path)
# create the checklist project
create_project(path = path, project = "flandersqmd-book")Then generate a skeleton for the report using create_report(). The function will guide you interactively through the process of setting up a report. Once the setup is completed the report will automatically be rendered in both html and pdf format. The respective output files are located in the output folder of the report folder. The function will also create an RStudio project file in the report folder. When you run the function from RStudio, the project will be opened automatically in a new session.
# Create a report skeleton
library(flandersqmd)
create_report(file.path(path, "flandersqmd-book"), reportname = "myreport")When starting a new report, you often don’t have all the metadata available yet. Run insert_missing_metadata() to add the required metadata to the report when it becomes available to you. E.g. the report number, DOI, …
insert_missing_metadata(file.path(path, "flandersqmd-book", "myreport"))flandersqmd does not create a cover page. You have to provide a cover page yourself. Use add_cover() to add a cover page to the report and then render the report again to include the cover page. Note that you can render a draft version of the report without cover page or missing metadata.
add_cover(
report_path = file.path(path, "flandersqmd-book", "myreport"),
cover_pdf = "path/to/cover.pdf"
)
# Render the report
quarto::quarto_render(file.path(path, "flandersqmd-book", "myreport"))Workshop
This package contains the slides of a workshop. Run the code below to render and view the slides.
workshop_path <- tempfile("flandersqmd_workshop")
dir.create(workshop_path)
system.file("workshop", package = "flandersqmd") |>
file.copy(workshop_path, recursive = TRUE)
oldwd <- getwd()
file.path(workshop_path, "workshop") |>
setwd()
quarto::quarto_add_extension("inbo/flandersqmd-revealjs", no_prompt = TRUE)
quarto::quarto_render(as_job = FALSE)
setwd(oldwd)
file.path(workshop_path, "output", "index.html") |>
browseURL()