| Title: | Explore and Visualize Camera Trap Data Packages |
|---|---|
| Description: | Explore and visualize Camera Trap Data Packages ('Camtrap DP', <https://camtrap-dp.tdwg.org/>). camtraptor offers a step-by-step workflow to read Camtrap DP files, filter data of interest, summarize information (e.g. number of observed species) and visualize this per deployment on an interactive map. You can also use it to transform data for analysis in 'camtrapR'. |
| Authors: | Damiano Oldoni [aut, cre] (ORCID: <https://orcid.org/0000-0003-3445-7562>, affiliation: Research Institute for Nature and Forest (INBO)), Peter Desmet [aut] (ORCID: <https://orcid.org/0000-0002-8442-8025>, affiliation: Research Institute for Nature and Forest (INBO)), Sanne Govaert [aut] (ORCID: <https://orcid.org/0000-0002-8939-1305>, affiliation: Research Institute for Nature and Forest (INBO)), Pieter Huybrechts [aut] (ORCID: <https://orcid.org/0000-0002-6658-6062>, affiliation: Research Institute for Nature and Forest (INBO)), Wolf Missotten [aut] (ORCID: <https://orcid.org/0009-0006-4069-0685>, affiliation: Ghent University), Martijn Bollen [ctb] (ORCID: <https://orcid.org/0000-0002-1621-6258>, affiliation: Research Institute for Nature and Forest (INBO)), Jim Casaer [ctb] (ORCID: <https://orcid.org/0000-0001-6788-5876>, affiliation: Research Institute for Nature and Forest (INBO)), Nele Mullens [ctb] (ORCID: <https://orcid.org/0000-0002-3054-9665>, affiliation: Regionaal Landschap Dijleland vzw), northfox [ctb], Raphaël Nussbaumer [ctb] (ORCID: <https://orcid.org/0000-0002-8185-1020>, affilication: Swiss Ornithological Institute), Thierry Onkelinx [ctb] (ORCID: <https://orcid.org/0000-0001-8804-4216>, affiliation: Research Institute for Nature and Forest (INBO)), Lynn Pallemaerts [ctb] (ORCID: <https://orcid.org/0000-0002-5034-5416>, affiliation: Research Institute for Nature and Forest (INBO)), Research Institute for Nature and Forest (INBO) [cph] (ROR: <https://ror.org/00j54wy13>), Research Foundation - Flanders [fnd] (https://lifewatch.be) |
| Maintainer: | Damiano Oldoni <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-10-07 16:49:18 UTC |
| Source: | https://github.com/inbo/camtraptor |
This function adds deployment coordinates to observations based on
deploymentID.
add_coordinates(x)add_coordinates(x)
x |
Camera trap data package object, as returned by
|
When the latitude and/or the longitude columns are already present in
observations, a warning is issued and the original object is returned
unchanged.
Camera trap data package object, where observations is updated by
appending two new columns: latitude and longitude
x <- example_dataset() # Add coordinates to observations add_coordinates(x) %>% observations()x <- example_dataset() # Add coordinates to observations add_coordinates(x) %>% observations()
These datasets are deprecated:
Use example_dataset() instead of mica.
Use animal_positions instead of animal_pos. Note that the column
sequenceID has been renamed to eventID.
Use calibration_models instead of calib_models.
Other sample data:
animal_positions,
calib_models,
calibration_models,
mica
A tibble data frame with the following columns:
deploymentID
eventID
x and y: The coordinates.
imageWidth and imageHeight: The image dimensions.
animal_positionsanimal_positions
An object of class tbl_df (inherits from tbl, data.frame) with 42 rows and 6 columns.
Other sample data:
animal_pos,
calib_models,
calibration_models,
mica
This function is deprecated. Use calculate_individual_radius_angle()
instead.
Calculates the position of animal relative to a camera based on image pixel positions and site calibration models.
calc_animal_pos( animal_pos, calib_models, dep_tag = "deploymentID", sequence_id = "eventID", x = "x", y = "y", image_width = "imageWidth", image_height = "imageHeight" )calc_animal_pos( animal_pos, calib_models, dep_tag = "deploymentID", sequence_id = "eventID", x = "x", y = "y", image_width = "imageWidth", image_height = "imageHeight" )
animal_pos |
Data frame (tibble) of animal position digitization
data. It must contain (at least) the columns defined in arguments
|
calib_models |
Named list of deployment calibration models or site
calibration models ( |
dep_tag |
Column in |
sequence_id |
Column in |
x |
Column in |
y |
Column in |
image_width |
Column in |
image_height |
Column in |
Original tibble data frame as passed via animal_positions with
additional columns:
radius: Radial distance from camera.
angle: Angular distance from camera.
frame_count: Indicator of the frame order within each sequence.
calc_animal_pos(animal_positions, calibration_models)calc_animal_pos(animal_positions, calibration_models)
Calculates the position of animal relative to a camera based on image pixel positions and site calibration models.
calculate_individual_radius_angle( animal_positions, calibration_models, deployment_id = "deploymentID", event_id = "eventID", x = "x", y = "y", image_width = "imageWidth", image_height = "imageHeight" )calculate_individual_radius_angle( animal_positions, calibration_models, deployment_id = "deploymentID", event_id = "eventID", x = "x", y = "y", image_width = "imageWidth", image_height = "imageHeight" )
animal_positions |
Data frame (tibble) of animal position digitization
data. It must contain (at least) the columns defined in args
|
calibration_models |
Named list of deployment calibration models or site
calibration models ( |
deployment_id |
Column in |
event_id |
Column in |
x |
Column in |
y |
Column in |
image_width |
Column in |
image_height |
Column in |
Original tibble data frame as passed via animal_positions with
additional columns:
radius: Radial distance from camera.
angle: Angular distance from camera.
frame_count: Indicator of the frame order within each sequence.
# Use default values calculate_individual_radius_angle(animal_positions, calibration_models)# Use default values calculate_individual_radius_angle(animal_positions, calibration_models)
These datasets are deprecated:
Use example_dataset() instead of mica.
Use animal_positions instead of animal_pos. Note that the column
sequenceID has been renamed to eventID.
Use calibration_models instead of calib_models.
Other sample data:
animal_pos,
animal_positions,
calibration_models,
mica
A list containing a number of calibration models (calibs) or site
calibration models (depcal).
The deployment names are used as names.
calibration_modelscalibration_models
An object of class calibs of length 4.
Other sample data:
animal_pos,
animal_positions,
calib_models,
mica
Re-export of camtrapdp::contributors().
contributors(x) contributors(x) <- valuecontributors(x) contributors(x) <- value
x |
Camera Trap Data Package object, as returned by |
value |
A data frame to assign as contributors. |
A tibble::tibble() data frame with the contributors, containing the
following columns (columns absent in x$contributors will be created):
title
firstName: if absent, this will be set to the first word in title,
except if it is a single word or the role is rightsHolder or
publisher.
lastName: if absent, this will be set to the remaining words in
title, with the same exceptions as firstName.
email
path
role
organization
Other accessor functions:
deployments(),
events(),
individuals(),
locations(),
media(),
observations(),
taxa()
x <- example_dataset() # Get contributors contributors(x) # Set contributors contributors(x) <- head(contributors(x), 1)x <- example_dataset() # Get contributors contributors(x) # Set contributors contributors(x) <- head(contributors(x), 1)
Re-export of camtrapdp::deployments().
deployments(x) deployments(x) <- valuedeployments(x) deployments(x) <- value
x |
Camera Trap Data Package object, as returned by |
value |
A data frame to assign as deployments. |
A tibble::tibble() data frame with deployments.
Other accessor functions:
contributors(),
events(),
individuals(),
locations(),
media(),
observations(),
taxa()
x <- example_dataset() # Get deployments deployments(x) # Set deployments (not recommended outside a function) deployments(x) <- head(deployments(x), 1)x <- example_dataset() # Get deployments deployments(x) # Set deployments (not recommended outside a function) deployments(x) <- head(deployments(x), 1)
Re-export of camtrapdp::events().
events(x)events(x)
x |
Camera Trap Data Package object, as returned by |
A tibble::tibble() data frame with the events, containing the
following columns:
deploymentID
eventID
eventStart
eventEnd
Other accessor functions:
contributors(),
deployments(),
individuals(),
locations(),
media(),
observations(),
taxa()
x <- example_dataset() events(x)x <- example_dataset() events(x)
Re-export of camtrapdp::example_dataset().
example_dataset()example_dataset()
Camera Trap Data Package object.
Other read sample data functions:
mica
example_dataset()example_dataset()
Re-export of camtrapdp::filter_deployments().
filter_deployments(x, ...)filter_deployments(x, ...)
x |
Camera Trap Data Package object, as returned by |
... |
Filtering conditions, see |
x filtered.
Other filter functions:
filter_media(),
filter_observations(),
filter_out_timelapse()
x <- example_dataset() # Filtering returns x, so pipe with deployments() to see the result x |> filter_deployments(deploymentID == "62c200a9") |> deployments() # Filtering on deployments also affects associated media and observations x_filtered <- filter_deployments(x, deploymentID == "62c200a9") media(x_filtered) observations(x_filtered) # Filtering on multiple conditions (combined with &) x |> filter_deployments(latitude > 51.0, longitude > 5.0) |> deployments() # Filtering on dates is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_deployments(lubridate::year(deploymentStart) == 2020) |> deployments() x |> filter_deployments( deploymentStart >= lubridate::as_date("2020-06-19"), deploymentEnd <= lubridate::as_date("2020-08-30") ) |> deployments()x <- example_dataset() # Filtering returns x, so pipe with deployments() to see the result x |> filter_deployments(deploymentID == "62c200a9") |> deployments() # Filtering on deployments also affects associated media and observations x_filtered <- filter_deployments(x, deploymentID == "62c200a9") media(x_filtered) observations(x_filtered) # Filtering on multiple conditions (combined with &) x |> filter_deployments(latitude > 51.0, longitude > 5.0) |> deployments() # Filtering on dates is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_deployments(lubridate::year(deploymentStart) == 2020) |> deployments() x |> filter_deployments( deploymentStart >= lubridate::as_date("2020-06-19"), deploymentEnd <= lubridate::as_date("2020-08-30") ) |> deployments()
Re-export of camtrapdp::filter_media().
filter_media(x, ...)filter_media(x, ...)
x |
Camera Trap Data Package object, as returned by |
... |
Filtering conditions, see |
x filtered.
Other filter functions:
filter_deployments(),
filter_observations(),
filter_out_timelapse()
x <- example_dataset() # Filtering returns x, so pipe with media() to see the result x |> filter_media(captureMethod == "timeLapse") |> media() # Filtering on media also affects associated observations, but not deployments x_filtered <- filter_media(x, favorite == TRUE) observations(x_filtered) # Filtering on multiple conditions (combined with &) x |> filter_media(captureMethod == "activityDetection", filePublic == FALSE) |> media() # Filtering on datetimes is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_media(lubridate::year(timestamp) == 2020) |> media() x |> filter_media( timestamp >= lubridate::as_datetime("2020-08-02 05:01:00"), timestamp <= lubridate::as_datetime("2020-08-02 05:02:00") ) |> media()x <- example_dataset() # Filtering returns x, so pipe with media() to see the result x |> filter_media(captureMethod == "timeLapse") |> media() # Filtering on media also affects associated observations, but not deployments x_filtered <- filter_media(x, favorite == TRUE) observations(x_filtered) # Filtering on multiple conditions (combined with &) x |> filter_media(captureMethod == "activityDetection", filePublic == FALSE) |> media() # Filtering on datetimes is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_media(lubridate::year(timestamp) == 2020) |> media() x |> filter_media( timestamp >= lubridate::as_datetime("2020-08-02 05:01:00"), timestamp <= lubridate::as_datetime("2020-08-02 05:02:00") ) |> media()
Re-export of camtrapdp::filter_observations().
filter_observations(x, ...)filter_observations(x, ...)
x |
Camera Trap Data Package object, as returned by |
... |
Filtering conditions, see |
x filtered.
Other filter functions:
filter_deployments(),
filter_media(),
filter_out_timelapse()
x <- example_dataset() # Filtering returns x, so pipe with observations() to see the result x |> filter_observations(observationType == "animal") |> observations() # Filtering on observations also affects associated media, but not deployments x |> filter_observations( scientificName == "Vulpes vulpes", observationLevel == "event" ) |> media() x |> filter_observations( scientificName == "Vulpes vulpes", observationLevel == "media" ) |> media() # Filtering on multiple conditions (combined with &) x |> filter_observations( deploymentID == "577b543a", scientificName %in% c("Martes foina", "Mustela putorius") ) |> observations() # Filtering on datetimes is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_observations(lubridate::year(eventStart) == 2020) |> observations() x |> filter_observations( eventStart >= lubridate::as_datetime("2020-06-19 22:00:00"), eventEnd <= lubridate::as_datetime("2020-06-19 22:10:00") ) |> observations()x <- example_dataset() # Filtering returns x, so pipe with observations() to see the result x |> filter_observations(observationType == "animal") |> observations() # Filtering on observations also affects associated media, but not deployments x |> filter_observations( scientificName == "Vulpes vulpes", observationLevel == "event" ) |> media() x |> filter_observations( scientificName == "Vulpes vulpes", observationLevel == "media" ) |> media() # Filtering on multiple conditions (combined with &) x |> filter_observations( deploymentID == "577b543a", scientificName %in% c("Martes foina", "Mustela putorius") ) |> observations() # Filtering on datetimes is easiest with lubridate library(lubridate, warn.conflicts = FALSE) x |> filter_observations(lubridate::year(eventStart) == 2020) |> observations() x |> filter_observations( eventStart >= lubridate::as_datetime("2020-06-19 22:00:00"), eventEnd <= lubridate::as_datetime("2020-06-19 22:10:00") ) |> observations()
Subsets observations in a Camera Trap Data Package object, removing timelapse
observations, i.e. observations where captureMethod = timeLapse. This
function is a shortcut for filter_observations(x, captureMethod != "timelapse").
filter_out_timelapse(x)filter_out_timelapse(x)
x |
Camera trap data package object, as returned by
|
x filtered.
Other filter functions:
filter_deployments(),
filter_media(),
filter_observations()
x <- example_dataset() # `x` doesn't contain timelapse observations, returned as is filter_out_timelapse(x) # Create a data package with timelapse observations obs <- observations(x) obs$captureMethod <- c(rep("timelapse", nrow(obs) - 1), "activityDetection") observations(x) <- obs # Filter out timelapse observations filter_out_timelapse(x)x <- example_dataset() # `x` doesn't contain timelapse observations, returned as is filter_out_timelapse(x) # Create a data package with timelapse observations obs <- observations(x) obs$captureMethod <- c(rep("timelapse", nrow(obs) - 1), "activityDetection") observations(x) <- obs # Filter out timelapse observations filter_out_timelapse(x)
This function is superseded because camtrapR supports reading Camera Trap
Data Packages. Use camtrapR::readCamtrapDP() and
camtrapR::cameraOperation() instead.
Creates a camera operation matrix. See vignette("camera-operation-matrix")
for more details on how to use this function.
get_cam_op( x, station_col = "locationName", camera_col = NULL, session_col = NULL, use_prefix = FALSE )get_cam_op( x, station_col = "locationName", camera_col = NULL, session_col = NULL, use_prefix = FALSE )
x |
Camera trap data package object, as returned by
|
station_col |
Column name to use for identifying the stations. Default:
|
camera_col |
Column name of the column specifying Camera ID. Default:
|
session_col |
Column name to use for identifying the session. Default:
|
use_prefix |
Logical ( |
The deployment data are by default grouped by locationName (Station ID in
camtrapR jargon) or another column specified by the user via the
station_col argument. If multiple deployments are linked to the same
location, daily efforts higher than 1 occur.
Partially active days, e.g. the first or the last day of a deployment, result
in decimal effort values as in camtrapR::cameraOperation().
A matrix. Rows are camera stations and columns are occassions (dates). Values indicate whether a camera was operational.
Other deprecated camtrapR-derived functions:
get_detection_history(),
get_record_table()
library(dplyr) library(stringr) x <- example_dataset() get_cam_op(x) # Specify column with station names get_cam_op(x, station_col = "locationID") # Specify column with session IDs x_sessions <- x deployments(x_sessions) <- deployments(x_sessions) %>% mutate(session = ifelse( str_starts(.data$locationName, "B_DL_"), "after2020", "before2020" )) get_cam_op(x_sessions, session_col = "session") # Specify column with camera IDs x_cameras <- x_sessions deployments(x_cameras) <- deployments(x_cameras) %>% mutate(cameraID = c(1, 2, 3, 4)) get_cam_op(x_cameras, camera_col = "cameraID") # Specify both session and camera IDs get_cam_op( x_cameras, camera_col = "cameraID", session_col = "session" ) # Use prefix Station as in camtrapR's camera operation matrix get_cam_op(x, use_prefix = TRUE)library(dplyr) library(stringr) x <- example_dataset() get_cam_op(x) # Specify column with station names get_cam_op(x, station_col = "locationID") # Specify column with session IDs x_sessions <- x deployments(x_sessions) <- deployments(x_sessions) %>% mutate(session = ifelse( str_starts(.data$locationName, "B_DL_"), "after2020", "before2020" )) get_cam_op(x_sessions, session_col = "session") # Specify column with camera IDs x_cameras <- x_sessions deployments(x_cameras) <- deployments(x_cameras) %>% mutate(cameraID = c(1, 2, 3, 4)) get_cam_op(x_cameras, camera_col = "cameraID") # Specify both session and camera IDs get_cam_op( x_cameras, camera_col = "cameraID", session_col = "session" ) # Use prefix Station as in camtrapR's camera operation matrix get_cam_op(x, use_prefix = TRUE)
This function is deprecated. Use summarize_deployments() instead.
Gets the effort for each deployment and a specific time interval such as day, week, month or year.
get_custom_effort( x, ..., start = NULL, end = NULL, group_by = NULL, unit = "hour" )get_custom_effort( x, ..., start = NULL, end = NULL, group_by = NULL, unit = "hour" )
x |
Camera trap data package object, as returned by
|
... |
|
start |
|
end |
|
group_by |
Character, one of |
unit |
|
A grouped tibble data frame with the following columns:
group_by names, e.g. deploymentID, latitude, longitude and
locationName.
group_time_by name if provided, e.g. month. It contains the first
date of the time interval, e.g. the first day of the month.
effort_duration: A duration object (duration is a class from lubridate
package). Duration is always recorded as a fixed number of seconds. See
lubridate::duration().
Other deprecated exploration functions:
get_effort(),
get_n_individuals(),
get_n_obs(),
get_n_species(),
get_rai(),
get_rai_individuals()
x <- example_dataset() # Effort for each deployment over the entire duration of the project get_custom_effort(x) # Effort at monthly interval get_custom_effort(x, group_by = "month") # You can afterwards calculate the total effort over all deployments library(dplyr) get_custom_effort(x, group_by = "year") %>% filter(effort_duration > 0) %>% group_by(year) %>% summarise( deploymentIDs = list(deploymentID), ndep = n_distinct(deploymentID), effort_duration = sum(effort_duration) )x <- example_dataset() # Effort for each deployment over the entire duration of the project get_custom_effort(x) # Effort at monthly interval get_custom_effort(x, group_by = "month") # You can afterwards calculate the total effort over all deployments library(dplyr) get_custom_effort(x, group_by = "year") %>% filter(effort_duration > 0) %>% group_by(year) %>% summarise( deploymentIDs = list(deploymentID), ndep = n_distinct(deploymentID), effort_duration = sum(effort_duration) )
This function is superseded because camtrapR supports reading Camera Trap
Data Packages. Use camtrapR::readCamtrapDP() and
camtrapR::detectionHistory() instead.
Creates species detection matrices. See
vignette("detection-history-matrix") for more details on how to use
this function.
get_detection_history( recordTable, camOp, species, output, occasionLength = 1, minActiveDaysPerOccasion = NULL, maxNumberDays = NULL, day1 = "station", buffer = NULL, unmarkedMultFrameInput = FALSE )get_detection_history( recordTable, camOp, species, output, occasionLength = 1, minActiveDaysPerOccasion = NULL, maxNumberDays = NULL, day1 = "station", buffer = NULL, unmarkedMultFrameInput = FALSE )
recordTable |
A record table created by |
camOp |
A camera operation matrix created by |
species |
Character. The species name. |
output |
Character. The type of output. Choose one of: |
occasionLength |
Integer. The length of the occasions in days. No
decimals allowed. Default: |
minActiveDaysPerOccasion |
Integer. Minimum number of active trap days
for occasions to be included. Default: |
maxNumberDays |
Integer. Maximum number of trap days per station.
Default: |
day1 |
Character. Day occasions should begin: station setup date
( |
buffer |
Integer. It makes the first occasion begin a number of days
after station setup. |
unmarkedMultFrameInput |
Logical. If |
If the camera operation matrix (camOp) was created for a multi-season study
(via argument session_col in get_cam_op()), the session will be detected
automatically. You can then set unmarkedMultFrameInput = TRUE to generate
a multi-season detection history. Each row corresponds to a site, and the
columns are in season-major, occasion-minor order, e.g. o1_SESS_A,
o2_SESS_A, o1_SESS_B, o2_SESS_B, etc.
A list with three elements:
detection_history: the detection history matrix
effort: the effort matrix
dates: the dates matrix
Other deprecated camtrapR-derived functions:
get_cam_op(),
get_record_table()
library(dplyr) library(stringr) x <- example_dataset() camOp <- get_cam_op(x) recordTable <- get_record_table(x) # More observations of the same species on the same day at the same station # are left. recordTable_mulitple <- get_record_table( x, removeDuplicateRecords = FALSE ) # Binary output get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "binary" ) # Number of observations output: same as binary with default # `get_record_table(x)` get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_observations" ) # Number of observations output: more than 1 if more than 1 observation of # the species on the same day at the same station get_detection_history( recordTable_mulitple, camOp, species = "Anas platyrhynchos", output = "n_observations" ) # Number of individuals output get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals" ) # Occasion length of 7 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", occasionLength = 7 ) # Use a `minActiveDaysPerOccasion` of 5 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", occasionLength = 7, minActiveDaysPerOccasion = 5 ) # Use a `maxNumberDays` of 5 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", maxNumberDays = 5 ) # Specify start date via `day1` get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "binary", day1 = "2020-06-22" ) # Use a `buffer` of 2 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", buffer = 2 ) # Multi-season detection history x_sessions <- x deployments(x_sessions) <- deployments(x_sessions) %>% mutate(session = ifelse( str_starts(.data$locationName, "B_DL_"), "after2020", "before2020" ) ) camOp_sessions <- get_cam_op( x_sessions, session_col = "session" ) recordTable_sessions <- get_record_table(x_sessions) # Create a multi-season detection history get_detection_history( recordTable_sessions, camOp_sessions, species = "Anas platyrhynchos", output = "n_individuals", unmarkedMultFrameInput = TRUE )library(dplyr) library(stringr) x <- example_dataset() camOp <- get_cam_op(x) recordTable <- get_record_table(x) # More observations of the same species on the same day at the same station # are left. recordTable_mulitple <- get_record_table( x, removeDuplicateRecords = FALSE ) # Binary output get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "binary" ) # Number of observations output: same as binary with default # `get_record_table(x)` get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_observations" ) # Number of observations output: more than 1 if more than 1 observation of # the species on the same day at the same station get_detection_history( recordTable_mulitple, camOp, species = "Anas platyrhynchos", output = "n_observations" ) # Number of individuals output get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals" ) # Occasion length of 7 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", occasionLength = 7 ) # Use a `minActiveDaysPerOccasion` of 5 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", occasionLength = 7, minActiveDaysPerOccasion = 5 ) # Use a `maxNumberDays` of 5 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", maxNumberDays = 5 ) # Specify start date via `day1` get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "binary", day1 = "2020-06-22" ) # Use a `buffer` of 2 days get_detection_history( recordTable, camOp, species = "Anas platyrhynchos", output = "n_individuals", buffer = 2 ) # Multi-season detection history x_sessions <- x deployments(x_sessions) <- deployments(x_sessions) %>% mutate(session = ifelse( str_starts(.data$locationName, "B_DL_"), "after2020", "before2020" ) ) camOp_sessions <- get_cam_op( x_sessions, session_col = "session" ) recordTable_sessions <- get_record_table(x_sessions) # Create a multi-season detection history get_detection_history( recordTable_sessions, camOp_sessions, species = "Anas platyrhynchos", output = "n_individuals", unmarkedMultFrameInput = TRUE )
This function is deprecated. Use summarize_deployments() instead.
Gets the effort (deployment duration) per deployment.
get_effort(x, ..., unit = "hour")get_effort(x, ..., unit = "hour")
x |
Camera trap data package object, as returned by
|
... |
|
unit |
|
A grouped tibble data frame with the following columns:
group_by names, e.g. deploymentID, latitude, longitude and
locationName.
group_time_by name if provided, e.g. month. It contains the first
date of the time interval, e.g. the first day of the month.
effort_duration: A duration object (duration is a class from lubridate
package). Duration is always recorded as a fixed number of seconds. See
lubridate::duration().
Other deprecated exploration functions:
get_custom_effort(),
get_n_individuals(),
get_n_obs(),
get_n_species(),
get_rai(),
get_rai_individuals()
x <- example_dataset() get_effort(x)x <- example_dataset() get_effort(x)
This function is deprecated. Use summarize_observations() instead.
Gets the number of individuals per deployment.
get_n_individuals(x, ..., species = "all", sex = NULL, life_stage = NULL)get_n_individuals(x, ..., species = "all", sex = NULL, life_stage = NULL)
x |
Camera trap data package object, as returned by
|
... |
|
species |
|
sex |
|
life_stage |
|
A tibble data frame with the following columns:
deploymentID: Deployment unique identifier.
scientificName: Scientific name of the species.
This column is omitted if parameter species = NULL.
n: Number of observations.
Other deprecated exploration functions:
get_custom_effort(),
get_effort(),
get_n_obs(),
get_n_species(),
get_rai(),
get_rai_individuals()
x <- example_dataset() # Get sum of `individualCount` for each species get_n_individuals(x) # Get sum of `individualCount` of all species (unidentified included) get_n_individuals(x, species = NULL) # Get number of observations of some species only, e.g. Anas platyrhynchos get_n_individuals(x, species = "Anas platyrhynchos") # Specify sex get_n_individuals(x, sex = "female") # Specify life stage get_n_individuals(x, life_stage = c("subadult", "adult"))x <- example_dataset() # Get sum of `individualCount` for each species get_n_individuals(x) # Get sum of `individualCount` of all species (unidentified included) get_n_individuals(x, species = NULL) # Get number of observations of some species only, e.g. Anas platyrhynchos get_n_individuals(x, species = "Anas platyrhynchos") # Specify sex get_n_individuals(x, sex = "female") # Specify life stage get_n_individuals(x, life_stage = c("subadult", "adult"))
This function is deprecated. Use summarize_observations() instead.
Gets the number of event-based observations per deployment.
get_n_obs(x, ..., species = "all", sex = NULL, life_stage = NULL)get_n_obs(x, ..., species = "all", sex = NULL, life_stage = NULL)
x |
Camera trap data package object, as returned by
|
... |
|
species |
|
sex |
|
life_stage |
|
A tibble data frame with the following columns:
deploymentID: Deployment unique identifier.
scientificName: Scientific name of the species.
This column is omitted if parameter species = NULL.
n: Number of observations.
Other deprecated exploration functions:
get_custom_effort(),
get_effort(),
get_n_individuals(),
get_n_species(),
get_rai(),
get_rai_individuals()
x <- example_dataset() # Get number of observations for each species get_n_obs(x) # Get number of obs of all species, not identified individuals as well get_n_obs(x, species = NULL) # Get number of observations of Anas platyrhynchos get_n_obs(x, species = "Anas platyrhynchos") # Specify sex get_n_obs(x, sex = "female") # Specify life stage get_n_obs(x, life_stage = c("subadult", "adult"))x <- example_dataset() # Get number of observations for each species get_n_obs(x) # Get number of obs of all species, not identified individuals as well get_n_obs(x, species = NULL) # Get number of observations of Anas platyrhynchos get_n_obs(x, species = "Anas platyrhynchos") # Specify sex get_n_obs(x, sex = "female") # Specify life stage get_n_obs(x, life_stage = c("subadult", "adult"))
This function is deprecated. Use summarize_observations() instead.
get_n_species(x, ...)get_n_species(x, ...)
x |
Camera trap data package object, as returned by
|
... |
|
A tibble data frame with the following columns:
deploymentID: Deployment unique identifier.
n: Number of observed and identified species.
Other deprecated exploration functions:
get_custom_effort(),
get_effort(),
get_n_individuals(),
get_n_obs(),
get_rai(),
get_rai_individuals()
x <- example_dataset() # Get number of species get_n_species(x)x <- example_dataset() # Get number of species get_n_species(x)
get_rai(x, ..., species = "all", sex = NULL, life_stage = NULL)get_rai(x, ..., species = "all", sex = NULL, life_stage = NULL)
x |
Camera trap data package object, as returned by
|
... |
|
species |
|
sex |
|
life_stage |
|
Gets the RAI (Relative Abundance Index) per deployment. The RAI is normalized
using 100 days deployment activity. In other words:
RAI = 100 * (n/effort) where n is the number of event-based observations
and effort is the effort duration in days.
It is deprecated as of camtraptor 1.0.0. Please use
summarize_observations()instead.
A tibble data frame with the following columns:
deploymentID: character vector with the deployment unique identifiers.
scientificName: character vector with the scientific name.
rai: numeric vector with the relative abundance index.
Other deprecated exploration functions:
get_custom_effort(),
get_effort(),
get_n_individuals(),
get_n_obs(),
get_n_species(),
get_rai_individuals()
x <- example_dataset() # Calculate RAI for all species get_rai(x) # species = "all" by default, so equivalent of get_rai(x, species = "all") # Selected species get_rai(x, species = c("Anas platyrhynchos", "Martes foina"))x <- example_dataset() # Calculate RAI for all species get_rai(x) # species = "all" by default, so equivalent of get_rai(x, species = "all") # Selected species get_rai(x, species = c("Anas platyrhynchos", "Martes foina"))
get_rai_individuals(x, ..., species = "all", sex = NULL, life_stage = NULL)get_rai_individuals(x, ..., species = "all", sex = NULL, life_stage = NULL)
x |
Camera trap data package object, as returned by
|
... |
|
species |
|
sex |
|
life_stage |
|
Gets the RAI (Relative Abundance Index) per deployment. The RAI is normalized
using 100 days deployment activity. In other words: RAI = 100 * (n/effort)
where n is the sum of individual counts related to event-based observations
and effort is the effort duration in days.
It is deprecated as of camtraptor 1.0.0. Please use
summarize_observations() instead.
A tibble data frame with the following columns:
deploymentID: Deployment unique identifier.
scientificName: Scientific name.
rai: Relative abundance index.
Other deprecated exploration functions:
get_custom_effort(),
get_effort(),
get_n_individuals(),
get_n_obs(),
get_n_species(),
get_rai()
x <- example_dataset() # Calculate RAI based on number of individuals get_rai_individuals(x) # species = "all" by default, so equivalent of get_rai_individuals(x, species = "all") # Selected species get_rai_individuals( x, species = c("Anas platyrhynchos", "Martes foina") )x <- example_dataset() # Calculate RAI based on number of individuals get_rai_individuals(x) # species = "all" by default, so equivalent of get_rai_individuals(x, species = "all") # Selected species get_rai_individuals( x, species = c("Anas platyrhynchos", "Martes foina") )
This function is superseded because camtrapR supports reading Camera Trap
Data Packages. Use camtrapR::readCamtrapDP() and camtrapR::recordTable()
instead.
Creates a record table. All dates and times are expressed in UTC format. See
vignette("record-table") for more details on how to use this function.
get_record_table( x, stationCol = "locationName", exclude = NULL, minDeltaTime = 0, deltaTimeComparedTo = NULL, removeDuplicateRecords = TRUE )get_record_table( x, stationCol = "locationName", exclude = NULL, minDeltaTime = 0, deltaTimeComparedTo = NULL, removeDuplicateRecords = TRUE )
x |
Camera trap data package object, as returned by
|
stationCol |
Character name of the column containing stations.
Default: |
exclude |
Character vector of scientific names to be excluded from the
record table. Default: |
minDeltaTime |
Time difference between records of the same species at the same station to be considered independent (in minutes). Default: 0. |
deltaTimeComparedTo |
One of |
removeDuplicateRecords |
Logical. If there are several records of the
same species, but e.g. different |
A tibble data frame containing species records and additional information about stations, date, time and further metadata, such as filenames and directories of the images (media) linked to the species records. Some more details about the columns returned:
Station: Character, station names, as found in the deployment column
defined in parameter stationCol.
Species: Character, the scientific name of the observed species.
n: Numeric, the number of observed individuals (renamed from
count in the
observations table).
DateTimeOriginal: Datetime object, as found in column eventStart of
observations, in UTC format.
Date: Date object, the date part of DateTimeOriginal, in UTC format.
Time: Character, the time part of DateTimeOriginal in UTC format.
delta.time.secs: Numeric, the duration in seconds from the previous
independent record of a given species at a certain location.
delta.time.mins: Numeric, the duration in minutes from the previous
independent record of a given species at a certain location.
delta.time.hours: Numeric, the duration in hours from the previous
independent record of a given species at a certain location.
delta.time.days: Numeric, the duration in days from the previous
independent record of a given species at a certain location.
Directory: List, file paths of the images linked to the given record,
as defined in column filePath of media.
Filename: List, file names of the images linked to the given record,
as defined in column fileName of media.
Latitude: Numeric, latitude of the station, based on deploymentID
of the observations.
Longitude: Numeric, longitude of the station, based on deploymentID
of the observations.
clock: Numeric, clock time in radians.
solar: Numeric, solar time in radians. Calculated using
overlap::sunTime, which essentially uses the approach described in
Nouvellet et al. (2012) doi:10.1111/j.1469-7998.2011.00864.x.
Other deprecated camtrapR-derived functions:
get_cam_op(),
get_detection_history()
library(lubridate) x <- example_dataset() get_record_table(x) # Create a new Camera Trap Data Package with dependent observations only for # demonstration. obs <- observations(x) obs[obs$observationID == "9e191d10",]$scientificName <- "Martes foina" x_dep <- x observations(x_dep) <- obs # Set a minDeltaTime of 100 minutes from last record get_record_table( x_dep, minDeltaTime = 100, deltaTimeComparedTo = "lastRecord" ) # Differences can occur between `deltaTimeCoparedTo` = "lastRecord" and # "lastIndependentRecord" obs <- observations(x) obs[obs$eventID == "02ae9f43", "eventStart"] <- as_datetime("2020-08-02 05:10:20") med <- media(x) rows_to_update <- which(med$eventID == "02ae9f43") med[rows_to_update, "timestamp"] <- as_datetime("2020-08-02 05:10:20") x_modified <- x observations(x_modified) <- obs media(x_modified) <- med rec_last_indep <- get_record_table( x_modified, minDeltaTime = 10, deltaTimeComparedTo = "lastIndependentRecord" ) rec_last <- get_record_table( x_modified, minDeltaTime = 10, deltaTimeComparedTo = "lastRecord" ) # Exclude observations of Anas platyrhynchos. get_record_table(x, exclude = "Anas platyrhynchos") # Specify column to pass station names get_record_table(x, stationCol = "locationID") # Include "duplicates", i.e. records of same species at same time, but # different attributes, such as life stage or sex. get_record_table( x, removeDuplicateRecords = FALSE )library(lubridate) x <- example_dataset() get_record_table(x) # Create a new Camera Trap Data Package with dependent observations only for # demonstration. obs <- observations(x) obs[obs$observationID == "9e191d10",]$scientificName <- "Martes foina" x_dep <- x observations(x_dep) <- obs # Set a minDeltaTime of 100 minutes from last record get_record_table( x_dep, minDeltaTime = 100, deltaTimeComparedTo = "lastRecord" ) # Differences can occur between `deltaTimeCoparedTo` = "lastRecord" and # "lastIndependentRecord" obs <- observations(x) obs[obs$eventID == "02ae9f43", "eventStart"] <- as_datetime("2020-08-02 05:10:20") med <- media(x) rows_to_update <- which(med$eventID == "02ae9f43") med[rows_to_update, "timestamp"] <- as_datetime("2020-08-02 05:10:20") x_modified <- x observations(x_modified) <- obs media(x_modified) <- med rec_last_indep <- get_record_table( x_modified, minDeltaTime = 10, deltaTimeComparedTo = "lastIndependentRecord" ) rec_last <- get_record_table( x_modified, minDeltaTime = 10, deltaTimeComparedTo = "lastRecord" ) # Exclude observations of Anas platyrhynchos. get_record_table(x, exclude = "Anas platyrhynchos") # Specify column to pass station names get_record_table(x, stationCol = "locationID") # Include "duplicates", i.e. records of same species at same time, but # different attributes, such as life stage or sex. get_record_table( x, removeDuplicateRecords = FALSE )
It is deprecated as of camtraptor 1.0.0. Please use taxa() instead.
get_species(x)get_species(x)
x |
Camera trap data package object, as returned by
|
A tibble data frame with taxonomic information.
x <- example_dataset() get_species(x)x <- example_dataset() get_species(x)
Re-export of camtrapdp::individuals().
individuals(x)individuals(x)
x |
Camera Trap Data Package object, as returned by |
A tibble::tibble() data frame with the individuals that have an
individualID, containing the following columns:
individualID
scientificName
lifeStage
sex
Other accessor functions:
contributors(),
deployments(),
events(),
locations(),
media(),
observations(),
taxa()
x <- example_dataset() individuals(x)x <- example_dataset() individuals(x)
Re-export of camtrapdp::locations().
locations(x)locations(x)
x |
Camera Trap Data Package object, as returned by |
A tibble::tibble() data frame with the locations, containing the
following columns:
locationID
locationName
latitude
longitude
coordinateUncertainty
Other accessor functions:
contributors(),
deployments(),
events(),
individuals(),
media(),
observations(),
taxa()
x <- example_dataset() locations(x)x <- example_dataset() locations(x)
This function is deprecated. Use map_summary() instead.
map_dep( x, feature, species = NULL, sex = NULL, life_stage = NULL, effort_unit = NULL, cluster = TRUE, hover_columns = c("n", "species", "deploymentID", "locationID", "locationName", "latitude", "longitude", "start", "end"), palette = "inferno", zero_values_show = TRUE, zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/000000/multiply.png", zero_values_icon_size = 10, na_values_show = TRUE, na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/FA5252/multiply.png", na_values_icon_size = 10, relative_scale = TRUE, max_scale = NULL, radius_range = c(10, 50) )map_dep( x, feature, species = NULL, sex = NULL, life_stage = NULL, effort_unit = NULL, cluster = TRUE, hover_columns = c("n", "species", "deploymentID", "locationID", "locationName", "latitude", "longitude", "start", "end"), palette = "inferno", zero_values_show = TRUE, zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/000000/multiply.png", zero_values_icon_size = 10, na_values_show = TRUE, na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/FA5252/multiply.png", na_values_icon_size = 10, relative_scale = TRUE, max_scale = NULL, radius_range = c(10, 50) )
x |
Camera trap data package object, as returned by
|
feature |
Feature to visualize. One of the columns generated by
Possible values present in output of
|
species |
|
sex |
|
life_stage |
|
effort_unit |
Time unit to use while visualizing deployment effort
duration. Ignored if
If |
cluster |
Logical value indicating whether using the cluster option
while visualizing maps. Default: |
hover_columns |
Character vector of the columns of |
palette |
The palette name or the color function that values will be
mapped to. Default:
For more options, see parameter |
zero_values_show |
Logical indicating whether to show deployments with
zero values. Default: |
zero_values_icon_url |
Character with URL to icon for showing
deployments with zero values. Use |
zero_values_icon_size |
A number to set the size of the icon to show
groups (e.g. deployments) with zero values. Use |
na_values_show |
Logical indicating whether to show groups (e.g.
deployments) with no observations when feature is |
na_values_icon_url |
Character with URL to icon for showing groups (e.g.
deployments) with no observations. Used only if |
na_values_icon_size |
A number to set the size of the icon for showing
groups (e.g. deployments) with no observations. Used only if |
relative_scale |
Logical indicating whether to use a relative color and
radius scale ( |
max_scale |
Number indicating the max value used to map color and radius. |
radius_range |
Vector of length 2 containing the lower and upper limit
of the circle radius. The lower value is used for deployments with zero
feature value, e.g. no observations, no identified species, zero RAI or
zero effort. The upper value is used for the deployment(s) with the highest
feature value ( |
Deployments with zero values are shown only if they are present in the
summary, df. If you want to show deployments with zero values not present
in the summary, be sure to have used extend = TRUE in
summarize_observations(). See the examples.
Notice also that the argument species is not present anymore. If you want
to visualize a feature only for a specific group of species, please filter
the Camera Trap Data Package using filter_observations() before using this
function. See the examples.
Leaflet map.
x <- example_dataset() # Filter a data package to get only the data of Anas platyrhynchos x_anas_p <- x %>% filter_observations(scientificName == "Anas platyrhynchos") # Show number of species x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_scientificName") # Show number of species: show deployments with no # observations (NA icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_scientificName") # Show total number of observations (all species) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos - show deployments with # no observations (zero icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos without extending the # summary: deployments with no observations are not shown x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Same result as above if you extend the summary but use # `zero_values_show` = `FALSE` x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_show = FALSE, zero_values_icon_url = NULL, zero_values_icon_size = NULL ) # You can eventually filter the species after summarizing, # although it could not be the most efficient way for large Camera Trap Data # Packages library(dplyr) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude", "scientificName") ) %>% filter(scientificName == "Anas platyrhynchos") %>% map_summary("n_scientificName") # Show number of individuals x_anas_p %>% summarize_observations() %>% map_summary("sum_count") # Show RAI x_anas_p %>% summarize_observations() %>% map_summary("rai_observations") # Show RAI (individual counts) x_anas_p %>% summarize_observations() %>% map_summary("rai_count") # Show effort (hours) x_anas_p %>% summarize_deployments() %>% map_summary("effort_duration") # Show effort (days) x %>% summarize_deployments() %>% map_summary("effort_duration", effort_unit = "day") # Show effort per month x %>% summarize_deployments(group_time_by = "month") %>% map_summary("effort_duration", effort_unit = "day") # Use viridis palette x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = "viridis") # Use a palette defined by color names x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("black", "blue", "white")) # Use a palette defined by hex colors x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("#000000", "#0000FF", "#FFFFFF")) # Use same icon but a non default color for zero values deployments, # E.g. red (hex: E74C3C) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/multiply.png" ) # Use another icon via a different URL, e.g. the character Fry from Futurama # in green (2ECC71) x_anas_p %>% summarize_observations(extend = TRUE) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png" ) # Set size of the icon for zero values deployments x %>% filter_observations(scientificName == "Anas platyrhynchos") %>% summarize_observations(extend = TRUE) %>% map_summary("n_observations", zero_values_icon_size = 30) # Use another icon url/size for visualizing groups with no observations # (NA, only for `n_scientificName` feature) x %>% filter_observations(deploymentID != "00a2c20d") %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( feature = "n_scientificName", na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/futurama-fry.png", na_values_icon_size = 60 ) # Disable cluster x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations", cluster = FALSE) # Show only number of observations and location name while hovering x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", hover_columns = c("locationName", "n_observations") ) # Use absolute scale for colors and radius x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( "n_scientificName", relative_scale = FALSE, max_scale = 4 ) # Change max and min size circles x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", radius_range = c(40, 150) )x <- example_dataset() # Filter a data package to get only the data of Anas platyrhynchos x_anas_p <- x %>% filter_observations(scientificName == "Anas platyrhynchos") # Show number of species x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_scientificName") # Show number of species: show deployments with no # observations (NA icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_scientificName") # Show total number of observations (all species) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos - show deployments with # no observations (zero icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos without extending the # summary: deployments with no observations are not shown x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Same result as above if you extend the summary but use # `zero_values_show` = `FALSE` x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_show = FALSE, zero_values_icon_url = NULL, zero_values_icon_size = NULL ) # You can eventually filter the species after summarizing, # although it could not be the most efficient way for large Camera Trap Data # Packages library(dplyr) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude", "scientificName") ) %>% filter(scientificName == "Anas platyrhynchos") %>% map_summary("n_scientificName") # Show number of individuals x_anas_p %>% summarize_observations() %>% map_summary("sum_count") # Show RAI x_anas_p %>% summarize_observations() %>% map_summary("rai_observations") # Show RAI (individual counts) x_anas_p %>% summarize_observations() %>% map_summary("rai_count") # Show effort (hours) x_anas_p %>% summarize_deployments() %>% map_summary("effort_duration") # Show effort (days) x %>% summarize_deployments() %>% map_summary("effort_duration", effort_unit = "day") # Show effort per month x %>% summarize_deployments(group_time_by = "month") %>% map_summary("effort_duration", effort_unit = "day") # Use viridis palette x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = "viridis") # Use a palette defined by color names x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("black", "blue", "white")) # Use a palette defined by hex colors x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("#000000", "#0000FF", "#FFFFFF")) # Use same icon but a non default color for zero values deployments, # E.g. red (hex: E74C3C) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/multiply.png" ) # Use another icon via a different URL, e.g. the character Fry from Futurama # in green (2ECC71) x_anas_p %>% summarize_observations(extend = TRUE) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png" ) # Set size of the icon for zero values deployments x %>% filter_observations(scientificName == "Anas platyrhynchos") %>% summarize_observations(extend = TRUE) %>% map_summary("n_observations", zero_values_icon_size = 30) # Use another icon url/size for visualizing groups with no observations # (NA, only for `n_scientificName` feature) x %>% filter_observations(deploymentID != "00a2c20d") %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( feature = "n_scientificName", na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/futurama-fry.png", na_values_icon_size = 60 ) # Disable cluster x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations", cluster = FALSE) # Show only number of observations and location name while hovering x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", hover_columns = c("locationName", "n_observations") ) # Use absolute scale for colors and radius x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( "n_scientificName", relative_scale = FALSE, max_scale = 4 ) # Change max and min size circles x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", radius_range = c(40, 150) )
This function visualizes deployments features such as number of detected species, number of observations and RAI (Relative Abundance Index) on a dynamic map. The circle size and color are proportional to the mapped feature.
map_summary( df, feature, effort_unit = NULL, cluster = TRUE, hover_columns = c(dplyr::group_vars(df), feature), palette = "inferno", zero_values_show = TRUE, zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/000000/multiply.png", zero_values_icon_size = 10, na_values_show = TRUE, na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/FA5252/multiply.png", na_values_icon_size = 10, relative_scale = TRUE, max_scale = NULL, radius_range = c(10, 50) )map_summary( df, feature, effort_unit = NULL, cluster = TRUE, hover_columns = c(dplyr::group_vars(df), feature), palette = "inferno", zero_values_show = TRUE, zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/000000/multiply.png", zero_values_icon_size = 10, na_values_show = TRUE, na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/FA5252/multiply.png", na_values_icon_size = 10, relative_scale = TRUE, max_scale = NULL, radius_range = c(10, 50) )
df |
Grouped data frame generated by |
feature |
Feature to visualize. One of the columns generated by
Possible values present in output of
|
effort_unit |
Time unit to use while visualizing deployment effort
duration. Ignored if
If |
cluster |
Logical value indicating whether using the cluster option
while visualizing maps. Default: |
hover_columns |
Character vector of the columns of |
palette |
The palette name or the color function that values will be
mapped to. Default:
For more options, see parameter |
zero_values_show |
Logical indicating whether to show deployments with
zero values. Default: |
zero_values_icon_url |
Character with URL to icon for showing
deployments with zero values. Use |
zero_values_icon_size |
A number to set the size of the icon to show
groups (e.g. deployments) with zero values. Use |
na_values_show |
Logical indicating whether to show groups (e.g.
deployments) with no observations when feature is |
na_values_icon_url |
Character with URL to icon for showing groups (e.g.
deployments) with no observations. Used only if |
na_values_icon_size |
A number to set the size of the icon for showing
groups (e.g. deployments) with no observations. Used only if |
relative_scale |
Logical indicating whether to use a relative color and
radius scale ( |
max_scale |
Number indicating the max value used to map color and radius. |
radius_range |
Vector of length 2 containing the lower and upper limit
of the circle radius. The lower value is used for deployments with zero
feature value, e.g. no observations, no identified species, zero RAI or
zero effort. The upper value is used for the deployment(s) with the highest
feature value ( |
Deployments with zero values are shown only if they are present in the
summary, df. If you want to show deployments with zero values not present
in the summary, be sure to have used extend = TRUE in
summarize_observations(). See the examples.
Notice also that the argument species is not present anymore. If you want
to visualize a feature only for a specific group of species, please filter
the Camera Trap Data Package using filter_observations() before using this
function. See the examples.
Leaflet map.
x <- example_dataset() # Filter a data package to get only the data of Anas platyrhynchos x_anas_p <- x %>% filter_observations(scientificName == "Anas platyrhynchos") # Show number of species x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_scientificName") # Show number of species: show deployments with no # observations (NA icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_scientificName") # Show total number of observations (all species) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos - show deployments with # no observations (zero icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos without extending the # summary: deployments with no observations are not shown x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Same result as above if you extend the summary but use # `zero_values_show` = `FALSE` x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_show = FALSE, zero_values_icon_url = NULL, zero_values_icon_size = NULL ) # You can eventually filter the species after summarizing, # although it could not be the most efficient way for large Camera Trap Data # Packages library(dplyr) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude", "scientificName") ) %>% filter(scientificName == "Anas platyrhynchos") %>% map_summary("n_scientificName") # Show number of individuals x_anas_p %>% summarize_observations() %>% map_summary("sum_count") # Show RAI x_anas_p %>% summarize_observations() %>% map_summary("rai_observations") # Show RAI (individual counts) x_anas_p %>% summarize_observations() %>% map_summary("rai_count") # Show effort (hours) x_anas_p %>% summarize_deployments() %>% map_summary("effort_duration") # Show effort (days) x %>% summarize_deployments() %>% map_summary("effort_duration", effort_unit = "day") # Show effort per month x %>% summarize_deployments(group_time_by = "month") %>% map_summary("effort_duration", effort_unit = "day") # Use viridis palette x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = "viridis") # Use a palette defined by color names x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("black", "blue", "white")) # Use a palette defined by hex colors x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("#000000", "#0000FF", "#FFFFFF")) # Use same icon but a non default color for zero values deployments, # E.g. red (hex: E74C3C) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/multiply.png" ) # Use another icon via a different URL, e.g. the character Fry from Futurama # in green (2ECC71) x_anas_p %>% summarize_observations(extend = TRUE) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png" ) # Set size of the icon for zero values deployments x %>% filter_observations(scientificName == "Anas platyrhynchos") %>% summarize_observations(extend = TRUE) %>% map_summary("n_observations", zero_values_icon_size = 30) # Use another icon url/size for visualizing groups with no observations # (NA, only for `n_scientificName` feature) x %>% filter_observations(deploymentID != "00a2c20d") %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( feature = "n_scientificName", na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/futurama-fry.png", na_values_icon_size = 60 ) # Disable cluster x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations", cluster = FALSE) # Show only number of observations and location name while hovering x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", hover_columns = c("locationName", "n_observations") ) # Use absolute scale for colors and radius x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( "n_scientificName", relative_scale = FALSE, max_scale = 4 ) # Change max and min size circles x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", radius_range = c(40, 150) )x <- example_dataset() # Filter a data package to get only the data of Anas platyrhynchos x_anas_p <- x %>% filter_observations(scientificName == "Anas platyrhynchos") # Show number of species x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_scientificName") # Show number of species: show deployments with no # observations (NA icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_scientificName") # Show total number of observations (all species) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos - show deployments with # no observations (zero icon and size as defaults) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary("n_observations") # Show number of observations of Anas platyrhynchos without extending the # summary: deployments with no observations are not shown x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations") # Same result as above if you extend the summary but use # `zero_values_show` = `FALSE` x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_show = FALSE, zero_values_icon_url = NULL, zero_values_icon_size = NULL ) # You can eventually filter the species after summarizing, # although it could not be the most efficient way for large Camera Trap Data # Packages library(dplyr) x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude", "scientificName") ) %>% filter(scientificName == "Anas platyrhynchos") %>% map_summary("n_scientificName") # Show number of individuals x_anas_p %>% summarize_observations() %>% map_summary("sum_count") # Show RAI x_anas_p %>% summarize_observations() %>% map_summary("rai_observations") # Show RAI (individual counts) x_anas_p %>% summarize_observations() %>% map_summary("rai_count") # Show effort (hours) x_anas_p %>% summarize_deployments() %>% map_summary("effort_duration") # Show effort (days) x %>% summarize_deployments() %>% map_summary("effort_duration", effort_unit = "day") # Show effort per month x %>% summarize_deployments(group_time_by = "month") %>% map_summary("effort_duration", effort_unit = "day") # Use viridis palette x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = "viridis") # Use a palette defined by color names x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("black", "blue", "white")) # Use a palette defined by hex colors x_anas_p %>% summarize_observations() %>% map_summary("n_observations", palette = c("#000000", "#0000FF", "#FFFFFF")) # Use same icon but a non default color for zero values deployments, # E.g. red (hex: E74C3C) x_anas_p %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude"), extend = TRUE ) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/multiply.png" ) # Use another icon via a different URL, e.g. the character Fry from Futurama # in green (2ECC71) x_anas_p %>% summarize_observations(extend = TRUE) %>% map_summary( "n_observations", zero_values_icon_url = "https://img.icons8.com/ios-glyphs/30/2ECC71/futurama-fry.png" ) # Set size of the icon for zero values deployments x %>% filter_observations(scientificName == "Anas platyrhynchos") %>% summarize_observations(extend = TRUE) %>% map_summary("n_observations", zero_values_icon_size = 30) # Use another icon url/size for visualizing groups with no observations # (NA, only for `n_scientificName` feature) x %>% filter_observations(deploymentID != "00a2c20d") %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( feature = "n_scientificName", na_values_icon_url = "https://img.icons8.com/ios-glyphs/30/E74C3C/futurama-fry.png", na_values_icon_size = 60 ) # Disable cluster x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary("n_observations", cluster = FALSE) # Show only number of observations and location name while hovering x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", hover_columns = c("locationName", "n_observations") ) # Use absolute scale for colors and radius x %>% summarize_observations( group_by = c("deploymentID", "latitude", "longitude") ) %>% map_summary( "n_scientificName", relative_scale = FALSE, max_scale = 4 ) # Change max and min size circles x %>% summarize_observations( group_by = c("deploymentID", "locationName", "latitude", "longitude") ) %>% map_summary( "n_observations", radius_range = c(40, 150) )
Re-export of camtrapdp::media().
media(x) media(x) <- valuemedia(x) media(x) <- value
x |
Camera Trap Data Package object, as returned by |
value |
A data frame to assign as media. |
A tibble::tibble() data frame with media.
Other accessor functions:
contributors(),
deployments(),
events(),
individuals(),
locations(),
observations(),
taxa()
x <- example_dataset() # Get media media(x) # Set media (not recommended outside a function) media(x) <- head(media(x), 1)x <- example_dataset() # Get media media(x) # Set media (not recommended outside a function) media(x) <- head(media(x), 1)
These datasets are deprecated:
Use example_dataset() instead of mica.
Use animal_positions instead of animal_pos. Note that the column
sequenceID has been renamed to eventID.
Use calibration_models instead of calib_models.
Other sample data:
animal_pos,
animal_positions,
calib_models,
calibration_models
Other read sample data functions:
example_dataset()
Re-export of camtrapdp::observations().
observations(x) observations(x) <- valueobservations(x) observations(x) <- value
x |
Camera Trap Data Package object, as returned by |
value |
A data frame to assign as observations. |
A tibble::tibble() data frame with observations.
Other accessor functions:
contributors(),
deployments(),
events(),
individuals(),
locations(),
media(),
taxa()
x <- example_dataset() # Get the observations observations(x) # Set observations (not recommended outside a function) observations(x) <- head(observations(x), 1)x <- example_dataset() # Get the observations observations(x) # Set observations (not recommended outside a function) observations(x) <- head(observations(x), 1)
This function is deprecated. Use read_camtrapdp() instead.
Reads files from a Camera Trap Data Package (Camtrap DP) into memory.
read_camtrap_dp(file)read_camtrap_dp(file)
file |
Path or URL to a |
Camera Trap Data Package object.
The read_camtrapdp() function supports older versions of Camtrap DP and
will automatically upgrade such datasets to the latest version of the
standard.
It currently supports versions 1.0, 1.0.1 and 1.0.2 (latest).
Observations can contain classifications at two levels:
Media-based observations (observationLevel = "media") are based on a
single media file and are directly linked to it via mediaID.
Event-based observations (observationLevel = "event") are based on an
event, defined as a combination of eventID, eventStart and eventEnd.
This event can consist of one or more media files, but is not directly linked
to these.
The read_camtrapdp() function will automatically assign eventIDs to
media, using media.deploymentID = observations.deploymentID and
observations.eventStart <= media.timestamp <= observations.eventEnd.
Note that this can result in media being linked to multiple events (and thus
being duplicated), for example when events and sub-events were defined.
Camtrap DP metadata has a taxonomic property that can contain extra
information for each scientificName found in observations.
Such information can include higher taxonomy (family, order, etc.) and
vernacular names in multiple languages.
The read_camtrapdp() function will automatically include this taxonomic
information in observations, as extra columns starting with taxon..
It will then update the taxonomic scope in the metadata to the unique
taxa() found in the data.
Camtrap DP metadata has a spatial and temporal property that contains the
spatial and temporal coverage of the package respectively.
The read_camtrapdp() function will automatically update (or create) the
spatial and temporal scopes in the metadata based on the data.
It also does this for the taxonomic scope (see higher).
A Camtrap DP can contain Data Resources not described by the standard.
Those are listed with the tables supported by the standard (i.e. deployments,
media, observations) in the resources property.
The read_camtrapdp() function will ignore these additional resources
and only read the tables described by the standard.
Additional resources can be read with frictionless::read_resource() if they
are tabular.
file <- "https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0.2/example/datapackage.json" x <- read_camtrapdp(file) xfile <- "https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0.2/example/datapackage.json" x <- read_camtrapdp(file) x
Re-export of camtrapdp::read_camtrapdp().
read_camtrapdp(file)read_camtrapdp(file)
file |
Path or URL to a |
A Camera Trap Data Package object.
The read_camtrapdp() function supports older versions of Camtrap DP and
will automatically upgrade such datasets to the latest version of the
standard.
It currently supports versions 1.0, 1.0.1 and 1.0.2 (latest).
Observations can contain classifications at two levels:
Media-based observations (observationLevel = "media") are based on a
single media file and are directly linked to it via mediaID.
Event-based observations (observationLevel = "event") are based on an
event, defined as a combination of eventID, eventStart and eventEnd.
This event can consist of one or more media files, but is not directly linked
to these.
The read_camtrapdp() function will automatically assign eventIDs to
media, using media.deploymentID = observations.deploymentID and
observations.eventStart <= media.timestamp <= observations.eventEnd.
Note that this can result in media being linked to multiple events (and thus
being duplicated), for example when events and sub-events were defined.
Camtrap DP metadata has a taxonomic property that can contain extra
information for each scientificName found in observations.
Such information can include higher taxonomy (family, order, etc.) and
vernacular names in multiple languages.
The read_camtrapdp() function will automatically include this taxonomic
information in observations, as extra columns starting with taxon..
It will then update the taxonomic scope in the metadata to the unique
taxa() found in the data.
Camtrap DP metadata has a spatial and temporal property that contains the
spatial and temporal coverage of the package respectively.
The read_camtrapdp() function will automatically update (or create) the
spatial and temporal scopes in the metadata based on the data.
It also does this for the taxonomic scope (see higher).
A Camtrap DP can contain Data Resources not described by the standard.
Those are listed with the tables supported by the standard (i.e. deployments,
media, observations) in the resources property.
The read_camtrapdp() function will ignore these additional resources
and only read the tables described by the standard.
Additional resources can be read with frictionless::read_resource() if they
are tabular.
file <- "https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0.2/example/datapackage.json" x <- read_camtrapdp(file) xfile <- "https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0.2/example/datapackage.json" x <- read_camtrapdp(file) x
Summarizes deployments information, more specifically the duration effort.
summarize_deployments( x, group_by = c("deploymentID", "latitude", "longitude"), group_time_by = NULL ) summarise_deployments( x, group_by = c("deploymentID", "latitude", "longitude"), group_time_by = NULL )summarize_deployments( x, group_by = c("deploymentID", "latitude", "longitude"), group_time_by = NULL ) summarise_deployments( x, group_by = c("deploymentID", "latitude", "longitude"), group_time_by = NULL )
x |
Camera trap data package object, as returned by
|
group_by |
Character vector with the names of the columns in
deployments. At the moment you can choose one or many columns among:
|
group_time_by |
Character, one of |
summarize_deployments() and summarise_deployments() are synonyms.
A grouped tibble data frame with the following columns:
group_by names, e.g. deploymentID, latitude, longitude and
locationName.
group_time_by name if provided, e.g. month. It contains the first
date of the time interval, e.g. the first day of the month.
effort_duration: A duration object (duration is a class from lubridate
package). Duration is always recorded as a fixed number of seconds. See
lubridate::duration().
Other exploration functions:
summarize_observations()
x <- example_dataset() # Return effort using default `group_by` and no time grouping summarize_deployments(x) # Return effort using default `group_by` and grouping by year summarize_deployments(x, group_time_by = "year") # Return effort specifying grouping columns, e.g. `deploymentID` and # `locationName` and grouping by day summarize_deployments( x, group_by = c("deploymentID", "locationName"), group_time_by = "day" ) # Afterwards, you can calculate the total effort over all deployments. You # can also show other information, e.g. the (number of) deployments and # locations. library(dplyr) summarize_deployments( x, group_by = c("deploymentID", "locationName"), group_time_by = "month" ) %>% group_by(month) %>% summarise( deploymentIDs = list(deploymentID), ndep = length(unique(deploymentID)), nloc = length(unique(locationName)), effort_duration = sum(effort_duration) )x <- example_dataset() # Return effort using default `group_by` and no time grouping summarize_deployments(x) # Return effort using default `group_by` and grouping by year summarize_deployments(x, group_time_by = "year") # Return effort specifying grouping columns, e.g. `deploymentID` and # `locationName` and grouping by day summarize_deployments( x, group_by = c("deploymentID", "locationName"), group_time_by = "day" ) # Afterwards, you can calculate the total effort over all deployments. You # can also show other information, e.g. the (number of) deployments and # locations. library(dplyr) summarize_deployments( x, group_by = c("deploymentID", "locationName"), group_time_by = "month" ) %>% group_by(month) %>% summarise( deploymentIDs = list(deploymentID), ndep = length(unique(deploymentID)), nloc = length(unique(locationName)), effort_duration = sum(effort_duration) )
Summarizes event-based observations by calculating:
Number of scientific names.
Number of events.
Number of observations.
Sum of individual counts.
Relative Abundance Index (RAI) based on number of observations.
Relative Abundance Index (RAI) based on individual counts.
summarize_observations( x, group_by = c("deploymentID", "latitude", "longitude", "scientificName"), group_time_by = NULL, extend = FALSE ) summarise_observations( x, group_by = c("deploymentID", "latitude", "longitude", "scientificName"), group_time_by = NULL, extend = FALSE )summarize_observations( x, group_by = c("deploymentID", "latitude", "longitude", "scientificName"), group_time_by = NULL, extend = FALSE ) summarise_observations( x, group_by = c("deploymentID", "latitude", "longitude", "scientificName"), group_time_by = NULL, extend = FALSE )
x |
Camera trap data package object, as returned by
|
group_by |
Character vector with names of columns in deployments and
observations. At the moment you can choose one or many columns among:
|
group_time_by |
Character, one of |
extend |
Logical. If |
summarize_observations() and summarise_observations() are synonyms.
By default (extend = FALSE), the function follows the standard behavior of
dplyr::summarise(), returning only groups that have observations. This
means deployments or time periods with zero observations for the specified
grouping are excluded from the output.
When extend = TRUE, the summary is extended to include all possible
combinations of grouping variables, even when no observations exist for a
particular group. This is particularly useful for visualisations
(map_summary()) and analysis as it identifies for example:
Deployments where a specific species was not observed.
Time periods when a specific species was not observed.
Presence/absence patterns across deployments.
For extended summaries, feature values are set to 0 for groups with no
observations, except for n_scientificName which is set to NA when no
species are present as 0 is used when only unidentified individuals are
observed.
A grouped tibble data frame with the following columns:
group_by names, e.g. deploymentID, latitude, longitude,
and scientificName.
group_time_by name if provided, e.g. month. It is a datetime column
containing the first date of the time interval, e.g. the first day of the
month.
n_scientificName: integer vector with the number of scientific names.
If scientificName is in group_by, n_scientificName is equal to 1 or
0, if scientificName = NA (unidentified animals).
n_events: integer vector with the number of events.
n_observations: integer vector with the number of observations.
sum_count: integer vector with the sum of individual counts.
rai_observations: numeric vector with the Relative Abundance Index
(RAI), defined as 100 * (n_observations/effort) where n_observations is
the number of observations and effort is the effort_duration as
returned by summarize_deployments() expressed in days.
rai_count: numeric vector with the Relative Abundance Index (RAI),
defined as 100 * (sum_count/effort) where sum_count is the sum of
individual counts and effort is the effort_duration as returned by
summarize_deployments() expressed in days.
Other exploration functions:
summarize_deployments()
x <- example_dataset() # Summarize observations by `deploymentID`, `latitude`, `longitude` and # `scientificName` (default) summarize_observations(x) # Summarize observations by `locationId`, and `locationName` (summary by # deployment columns only) summarize_observations(x, group_by = "locationName") # Summarize observations by `scientificName` and `sex` (summary by # observation columns only) summarize_observations(x, group_by = c("scientificName", "sex")) # Apply temporal grouping by month summarize_observations(x, group_time_by = "month") # Extend the summary to include all possible groups summarize_observations(x, extend = TRUE)x <- example_dataset() # Summarize observations by `deploymentID`, `latitude`, `longitude` and # `scientificName` (default) summarize_observations(x) # Summarize observations by `locationId`, and `locationName` (summary by # deployment columns only) summarize_observations(x, group_by = "locationName") # Summarize observations by `scientificName` and `sex` (summary by # observation columns only) summarize_observations(x, group_by = c("scientificName", "sex")) # Apply temporal grouping by month summarize_observations(x, group_time_by = "month") # Extend the summary to include all possible groups summarize_observations(x, extend = TRUE)
Re-export of camtrapdp::taxa().
taxa(x)taxa(x)
x |
Camera Trap Data Package object, as returned by |
A tibble::tibble() data frame with the taxonomic information,
containing at least a scientificName column.
Other accessor functions:
contributors(),
deployments(),
events(),
individuals(),
locations(),
media(),
observations()
x <- example_dataset() taxa(x)x <- example_dataset() taxa(x)