Camera data wrangling
camera-data-wrangling.Rmd
The use of camera traps in ecological studies has become increasingly popular for monitoring wildlife. Managing and analyzing camera trap data efficiently is important for extracting meaningful and accurate insights. In this vignette, we will explore how to perform camera data wrangling, specifically focusing on the ABMI’s Ecosystem Health 2014 data set.
Use the wt_download_report()
function to retrieve the
main report for the CAM sensor in the Ecosystem Health 2014 project:
eh14_raw <- wt_download_report(
project_id = 205,
sensor_id = "CAM",
report = "main",
weather_cols = FALSE
)
Evaluate independent detections with
wt_ind_detect()
:
# Back to the Ecosystem Health 2014 data.
eh14_detections <- wt_ind_detect(
x = eh14_raw,
threshold = 30,
units = "minutes",
remove_human = TRUE,
remove_domestic = TRUE
)
glimpse(eh14_detections, width = 75)
313 independent detections in this data set, when using a threshold of 30 minutes.
The output from wt_ind_detect()
gave us some useful
information. But we probably need to do additional wrangling for our
data to be in the proper format for certain modeling techniques
(e.g. habitat modeling, occupancy). For example, we want to evaluate the
number of detections in a specified time interval (e.g. daily, weekly,
or monthly), including zeroes.
Summarise your camera data
With wt_summarise_cam()
you can get:
- The output from
wt_ind_detect()
(e.g. the objecteh14_detections
) - Your raw data (e.g. the object
eh14_raw
) - The time interval you’re interested in (e.g. weekly)
- The variable you’re interested in (e.g. detections, presence/absence)
- The desired output format (‘wide’ or ‘long’)
# A call to `wt_summarise_cam()`:
eh14_summarised <- wt_summarise_cam(
# Supply your detection data
detect_data = eh14_detections,
# Supply your raw image data
raw_data = eh14_raw,
# Now specify the time interval you're interested in
time_interval = "week",
# What variable are you interested in?
variable = "detections",
# Your desired output format (wide or long)
output_format = "wide"
)
The ultimate pipeline
library(wildrtrax)
Sys.setenv(WT_USERNAME = "*****",
WT_PASSWORD = "*****")
wt_auth()
projects <- wt_get_download_summary("CAM") %>%
filter(project == "ABMI Ecosystem Health 2014") %>%
select(project_id) %>%
pull()
raw_data <- map_dfr(.x = projects,
.f = ~wt_download_report(.x, "CAM", weather_cols = F, reports = "main")
summarised <- wt_ind_detect(raw_data, 30, "minutes") %>%
wt_summarise_cam(raw_data, "day", "detections", "long")
And now you can get straight into the science!