Summarize information about cameras activity from camera trap data.
Arguments
- dfrec
the records dataframe: must contain the camera names and some infortmation on the pictures sampling time (date and time or datetime).
- cam_col
name of the column containing the camera ID
- datetime_col
name of the column containing timestamps for the pictures (optional if
date_colandtime_colare provided)- date_col
name of the column containing date (optional if
datetime_colis provided)- time_col
name of the column containing time (optional if
datetime_colis provided)- spp_col
name of the species column (optional). If present, the summarry will include the number of species seen on each camera.
- obstype_col
name of the observation type column
- dfcam
the dataframe of cameras deployments (optional).
- cam_col_dfcam
name of the column containing camera ID in
dfcamIfdfcamis provided butcam_col_dfcamisNULL, it will be set tocam_col.- setup_col
name of the column containing setup date or datetime in
dfcam(optional)- retrieval_col
name of the column containing retrieval date or datetime in
dfcam(optional)
Value
The summary is returned as a dataframe with the following columns:
a column named as
cam_colcontaining the camera ID.sampling_lengthlength of the sampling period in days (computed with thecameraOperationfunction from thecamtrapRpackage). IfsetuporretrievalareNA, thensampling_lengthisNAand ifsetupandretrievalare the same (e.g. unique picture),sampling_lengthis zero.pictures: the number of pictures taken with this camera (it is zero if the camera is only indfcambut not indfrec).species(present only ifspp_colis provided): number of species caught on camera. Ifobstype_colis provided, species marked asNAinspp_colbut which have different values inobs_typeare counted as different species.setupcontaining the start of the sampling for each camera.retrievalcontaining the end of the sampling for each camera.setup_origincontaining the method used to determine the start of the sampling (pictureorsetup)retrieval_origincontaining the method used to determine the end of the sampling (pictureorretrieval)
Details
In the final dataframe, the start and the end of the sampling are computed as follows for each camera:
if setup and retrieval date are provided in
dfcam, then these dates are used for the start and the end of the sampling in the summary.for the cameras for which this information is not provided, it will be replaced with the date of the first or the last picture of the camera. The information on how the start and the end of the sampling were computed is stored in
setup_originandretrieval_origin.if setup and retrieval date are provided via
dfcam,setup_originandretrieval_originaremetadata.else, these columns contain
picture.if
dfcamis provided but has no setup or retrieval columns, then the cameras will be added but all columns except camera name will beNA. As this function uses thecameraOperationfunction from thecamtrapRpackage, the camera names may not containCamas it is a reserved name in this function.
Examples
# Create synthetic data
records <- data.frame(species = c("pigeon", "mouse", "pigeon", "mouse", "mouse"),
stamp = as.POSIXct(c("2022-01-01 10:22:01", "2022-03-01 22:12:01",
"2022-01-02 11:54:33", "2022-01-12 07:14:38",
"2022-01-22 18:01:34")),
camera = c("A", "A", "B", "B", "B"))
cameras <- data.frame(camera = c("A", "B", "C"),
setup = as.Date(c(NA, "2021-12-01", "2021-12-01")),
retrieval = as.Date(c("2022-03-01", "2022-03-01", NA)))
# Summarize cameras
summarize_cameras(records,
cam_col = "camera", datetime_col = "stamp",
dfcam = cameras,
setup_col = "setup", retrieval_col = "retrieval",
spp_col = "species")
#> camera pictures species sampling_length setup retrieval
#> 1 A 2 2 58.568 2022-01-01 10:22:01 2022-03-01
#> 2 B 3 2 90.000 2021-12-01 00:00:00 2022-03-01
#> 3 C 0 NA NA 2021-12-01 00:00:00 <NA>
#> setup_origin retrieval_origin
#> 1 picture metadata
#> 2 metadata metadata
#> 3 metadata <NA>
# Since camera A had no setup date, the first picture is used.
# For camera B, setup and retrieval are taken from dfcam.
# For camera C, as it is present only on dfcam and has no retrieval date,
# only a setup date is indicated.
