Skip to contents

One call turns an object, a model, a solved scenario or a comparison into a document: HTML, PDF, Word or LaTeX

PDF, A4, one page · energyRt 0.91.5.9015 (dev) · 2026-11-29
An object
First page of the coal plant's report
report(ECOA)
Its diagram, parameters and an ex-ante levelized cost.
A model
First page of the TOPIA model report
report(mod)
Configuration, inventory, investment windows, then every process.
A solved scenario
First page of the CO2CAP scenario report
report(CO2CAP)
Status, objective, mixes, a dispatch day, emissions and costs.
A comparison
First page of the report comparing BASE and CO2CAP
report(cmp)
cmp <- compare_scenarios(list(BASE, CO2CAP)): what differs, and where.
The call
report(object, template, file, format, levcost, open, ...)
Renders, writes and (interactively) opens a document; returns its path.
format = "html" self-contained page (default)
"pdf", "tex" need LaTeX (tinytex); skipped with a warning without it
"docx" Word, in Word's own styles
c("html", "pdf") one file per format

report_html(), report_pdf(), report_docx(), report_tex() are the same call with the format fixed.

By class
technology, storage datasheet: diagram, parameters, levelized cost; model =, scenario = place it in a system, geoscale = maps it
commodity, supply, demand, import, export, trade, weather, constraint, tax, subsidy, calendar, horizon their declared data, drawn and tabulated
repository, model the whole input; groups = orders the processes
scenario the results; run = picks a solve
comparison two or more scenarios side by side
report(ECOA, format = c("html", "docx"))
report(mod, groups = list(
  Fossil = c("ECOA", "EGAS"),
  Renewable = c("ESOL", "EWIN")))
Your own template
report_templates()[, c("name",
                       "class")]
         name      class
1    calendar   calendar
2   commodity  commodity
3      config     config
4  constraint constraint
5       costs      costs
…
The shipped templates: R Markdown files, one per class.
file.copy(subset(report_templates(),
  name == "generic")$path, "my.Rmd")
# edit my.Rmd, then
report(ECOA, template = "my.Rmd")
A template gets the same params as the one it was copied from.
Template helpers

Each renders correctly to HTML, Word and LaTeX: call them, never hand-written markup.

report_setup() chunk options; returns the output kind
report_sec() section title and note
report_tbl() a table: rounded, pruned, scrollable
report_fig() a ggplot sized by its facets
report_img(), report_img_row() images, logos
report_header() name, description, logo
report_pagebreak() a page break in every format
report_fmt_val(), report_esc() numbers and text
Where they go
set_reports_path(path)
The default folder; otherwise the project's reports/, or the scenario's own.
clear_report_cache(x, dry_run, …)
A report is re-rendered only when its object changed; this forgets them (force = TRUE for one).
  • file = writes exactly there; open = FALSE in scripts.
  • levcost = passes a result from levcost() instead of computing one.
  • image_file =, logos = put pictures in the header.
In a script
for (s in list(BASE, CO2CAP))
  report(s, format = c("html", "pdf"),
         open = FALSE)
One document per scenario and format, named after the scenario.
  • A report is re-rendered only when its object changed: after editing a template, pass force = TRUE.
  • open defaults to interactive(): a script writes and moves on.
  • PDF and LaTeX need a LaTeX installation; HTML and Word need only pandoc, which ships with RStudio and Quarto.