Skip to contents

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) <- value

Arguments

x

A camReport object created by camData().

name

A character vector naming fields to retrieve, or a single character string naming the field to update. When omitted from info(), the default report-information fields are returned.

value

The new value to assign to the specified field.

Value

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.

Examples

# \donttest{
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)
#> 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.

# 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)
# }