Aggregates a camera trap table from a station-camera (location-deployment) level to a station (location) level. This function is useful when modeling or analysis is conducted at the station level, when multiple cameras were deployed at a single station or a single camera had multiple deployments.
aggregateStations(
CTtable,
stationCol,
cameraCol = NULL,
setupCol = NULL,
retrievalCol = NULL,
dateFormat = NULL
)
A data frame with one row per unique station, containing aggregated information. Spatial information (for `sf` objects) is preserved.
A data frame or `sf` object representing the camera trap table. Each row typically represents a unique camera deployment.
A character string specifying the name of the column in CTtable
that contains the unique station identifiers.
A character string specifying the name of the column in CTtable
that contains the unique camera (deployment) identifiers.
character. name of the column containing camera setup dates
in CTtable
character. name of the column containing camera
retrieval dates in CTtable
character. The format of columns setupCol
and
retrievalCol
(and potential problem columns) in CTtable
. Must
be interpretable by either as.Date
or the "orders" argument
parse_date_time
in lubridate. Can be a date
or a date-time.
The aggregation logic handles different column types as follows:
Station ID (specified by `stationCol`): Remains unique for each row in the output.
Camera ID (if present): A character vector (comma-separated) of unique camera IDs deployed at that station.
Setup/Retrieval Dates: The earliest setup date and the latest retrieval date for all deployments within a station will be retained.
Numeric Columns: The `mean` of all values for that station will be calculated.
Logical Columns: The `mean` (which effectively calculates the proportion of `TRUE`s) of all values for that station will be calculated.
Character Columns (other than Camera ID): A character vector of unique values (comma-separated) for that station will be created.
Factor Columns: Similar to character columns, unique levels will be combined.
Geometry Column (`sf` objects): Centroid (midpoint) of all unique points at a station is calculated.
It is recommended to inspect the aggregated output carefully, especially for columns with mixed data types or specific aggregation requirements not covered by the defaults.