render_report: Render a water-quality report from the internal R Markdown template
Description
Renders an HTML report using the package's internal R Markdown template.
By default, the output is written to a temporary directory to comply
with CRAN policies. The function returns (invisibly) the full path to the
generated file.
Invisible character string: the absolute path to the generated report.
Arguments
df
Data frame with the input data used by the template.
meta
Named list with contextual metadata (e.g., river, period).
output_file
File name for the report (default "wq_report.html").
output_dir
Directory where the file will be written (default tempdir()).
It will be created if it does not exist.
template
Path to the internal template file. Defaults to the package
Rmd template shipped under inst/templates/report_rmd.Rmd.
Notes
The default output directory is tempdir() to comply with CRAN policies.
All files (including intermediate files generated during rendering) are
written only to output_dir or temporary directories, never to the package
installation directory.
The template is an Rmd (R Markdown). If you prefer Quarto, provide a
custom template path to a .qmd and ensure your environment supports it.
Details
The template expects a data frame with columns compatible with the package
(e.g., ponto, data, parameters used by IQA/CONAMA checks). You can pass
optional metadata via meta, such as river and period.
This function relies on rmarkdown (listed in Suggests). If the package
is not available, an informative error is thrown.
# Minimal example (writes to a temporary directory)d <- wq_demo
path <- render_report(d, meta = list(river = "Example River", period = "Jan–Feb"))
file.exists(path)