Get selected information fields from a camReport
object or update the value of a field used in report generation.
Usage
# S4 method for class 'camReport'
info(x, name)
# S4 method for class 'camReport'
info(x, name) <- valueValue
info() returns an object of class camInfo containing the
requested
fields. The replacement method returns the updated camReport object
invisibly.
Details
A camReport object contains metadata and report information extracted from
the camera-trap dataset, such as title, subtitle, authors, institute, site
name, description, and acknowledgement text.
The info function can be used to inspect selected fields. The replacement
form, info(x, name) <- value, can be used to update report information
before generating the report.
The getter accepts actual camReport field names, such as "title" and
"description". The replacement form also recognises the following
convenience names (case-insensitive):
| Replacement name | Updated content |
"study area" | The description field. |
"introduction" | Text of the introduction module. |
"image processing" | Text of the image-processing module. |
"sampling effort" or "sampling efforts" | Text of the sampling-effort module. |
"acknowledgement" or "acknowledgements" | Text of the acknowledgements module. |
Other replacement names must match a field name exactly. To target a
particular module variant, use updateReportSection() with its module name.
Edits to report text affect the object; they do not rewrite the original
dataset or the bundled YAML files.
Examples
# \donttest{
# Use the small dataset to demonstrate metadata access and editing.
source_dataset <- system.file(
"external",
"example-small",
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)
#> The camReport object is being created...
#> Dataset size: 164.4 KB.
#> File size looks modest, but full object creation may still take several minutes depending on the number of records.
#> Taxonomic class is unavailable for 10 recorded taxa. Class-dependent groups and mammal counts may be incomplete; missing classification does not indicate ecological absence. Supply source classifications or explicitly enable GBIF enrichment and rebuild with update = TRUE.
#> Setup is done!
#> Data loaded successfully in 13 sec.
#> camReport object is ready for GMU8 LEUVEN.
# Retrieve all report information
info(cm)
#> $title
#> [1] "Camera-Trap Monitoring Report for GMU8 LEUVEN, Belgium"
#>
#> $subtitle
#> [1] "Ecological insights from camera-trap data for wildlife monitoring"
#>
#> $authors
#> [1] "Martijn Bollen, Niko Boone, Jim Casaer, Peter Desmet, Sander Devisscher, Sanne Govaert, Lynn Pallemaerts, Anneleen Rutten, and Jan Vercammen"
#>
#> $institute
#> [1] "Research Institute for Nature and Forest (INBO)"
#>
#> $siteName
#> [1] "GMU8 LEUVEN"
#>
#> $logoPath
#> [1] ""
#>
#> attr(,"class")
#> [1] "camInfo"
# Retrieve selected fields
selected_info <- info(
cm,
name = c("title", "authors", "institute")
)
selected_info
#> $title
#> [1] "Camera-Trap Monitoring Report for GMU8 LEUVEN, Belgium"
#>
#> $authors
#> [1] "Martijn Bollen, Niko Boone, Jim Casaer, Peter Desmet, Sander Devisscher, Sanne Govaert, Lynn Pallemaerts, Anneleen Rutten, and Jan Vercammen"
#>
#> $institute
#> [1] "Research Institute for Nature and Forest (INBO)"
#>
#> attr(,"class")
#> [1] "camInfo"
# Update individual fields
info(cm, "title") <- "Camera-trap monitoring report"
info(cm, "institute") <- "Example Wildlife Research Institute"
# Inspect the updated fields
info(
cm,
name = c("title", "institute")
)
#> $title
#> [1] "Camera-trap monitoring report"
#>
#> $institute
#> [1] "Example Wildlife Research Institute"
#>
#> attr(,"class")
#> [1] "camInfo"
unlink(example_dataset, recursive = TRUE, force = TRUE)
# }