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_col
andtime_col
are provided)- date_col
name of the column containing date (optional if
datetime_col
is provided)- time_col
name of the column containing time (optional if
datetime_col
is 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
dfcam
Ifdfcam
is provided butcam_col_dfcam
isNULL
, 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_col
containing the camera ID.sampling_length
length of the sampling period in days (computed with thecameraOperation
function from thecamtrapR
package). Ifsetup
orretrieval
areNA
, thensampling_length
isNA
and ifsetup
andretrieval
are the same (e.g. unique picture),sampling_length
is zero.pictures
: the number of pictures taken with this camera (it is zero if the camera is only indfcam
but not indfrec
).species
(present only ifspp_col
is provided): number of species caught on camera. Ifobstype_col
is provided, species marked asNA
inspp_col
but which have different values inobs_type
are counted as different species.setup
containing the start of the sampling for each camera.retrieval
containing the end of the sampling for each camera.setup_origin
containing the method used to determine the start of the sampling (picture
orsetup
)retrieval_origin
containing the method used to determine the end of the sampling (picture
orretrieval
)
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_origin
andretrieval_origin
.if setup and retrieval date are provided via
dfcam
,setup_origin
andretrieval_origin
aremetadata
.else, these columns contain
picture
.if
dfcam
is 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 thecameraOperation
function from thecamtrapR
package, the camera names may not containCam
as 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.