Generate automated HTML reports from a camReport
object. report() creates an ecological report, while status() creates a
data-status report summarising data completeness, structure, and quality.
Arguments
- object
- filename
An optional character string giving the output filename or file path without an extension. The default is
"report"forreport()and"data_status"forstatus(). Relative default filenames are written to the camera-trap data directory.- view
A logical value (default
FALSE) specifying whether the generated HTML report is opened after rendering.- test
A logical value (default
FALSE). IfTRUE, report modules are tested when ecological report generation fails, helping identify problematic modules.
Details
Both functions create an intermediate R Markdown file and render it to HTML.
By default, report() creates report.html and report.Rmd, while
status() creates data_status.html and data_status.Rmd.
The ecological report is generated from the report modules attached to the
camReport object. The data-status report is generated from status modules
that summarise key aspects of the dataset, including spatial, temporal,
annotation, validation, and species-level information.
If test = TRUE is used with report(), the package attempts to test report
modules when rendering fails. This can help identify modules that cause
errors during report generation.
See also
camData(), reportSection(), updateReportSection(),
section_names()
Other report generation:
gui,camReport-method
Examples
# \donttest{
if (rmarkdown::pandoc_available()) {
source_dataset <- system.file(
"external",
"dataset",
package = "camtrapReport"
)
example_dataset <- tempfile("camtrapReport-example-")
dir.create(example_dataset)
invisible(file.copy(
list.files(source_dataset, full.names = TRUE),
example_dataset,
recursive = TRUE
))
cm <- camData(example_dataset)
# Use one lightweight section for the ecological report
cm <- sections(cm, "introduction")
# Generate an ecological report in a temporary directory
report_stem <- tempfile("camtrapReport-report-")
report_file <- report(
cm,
filename = report_stem,
view = FALSE
)
file.exists(report_file)
# Remove files generated by the examples
unlink(c(
report_file,
paste0(report_stem, ".Rmd"),
example_dataset
), recursive = TRUE, force = TRUE)
}
#> The camReport object is being created...
#> Dataset size: 6.6 MB.
#> File size looks modest, but full object creation may still take several minutes depending on the number of records.
#> Setup is done!
#> Data loaded successfully in 26 sec.
#> camReport object is ready for GMU8 LEUVEN.
#>
#> The report sections are updated.
#> Rendering R Markdown report ...
#> Report generated at: C:\Users\ebrah010\AppData\Local\Temp\RtmpuSpjaR\camtrapReport-report-d3907863cd3.html
# }