get_custom_effort: Get custom effort

View source: R/get_custom_effort.R

get_custom_effortR Documentation

Get custom effort

Description

Gets the effort for each deployment and a specific time interval such as day, week, month or year. A custom time window can also be set up. This function calls get_cam_op() internally.

Usage

get_custom_effort(
  package = NULL,
  ...,
  start = NULL,
  end = NULL,
  group_by = NULL,
  unit = "hour",
  datapkg = lifecycle::deprecated()
)

Arguments

package

Camera trap data package object, as returned by read_camtrap_dp().

...

filter predicates

start

Start date. Default: NULL. If NULL the earliest start date among all deployments is used. If group_by unit is not NULL, the lowest start value allowed is one group by unit before the start date of the earliest deployment. If this condition doesn't hold true, a warning is returned and the earliest start date among all deployments is used. If group_by unit is NULL the start must be later than or equal to the start date among all deployments.

end

End date. Default: NULL. If NULL the latest end date among all deployments is used. If group_by unit is not NULL, the latest end value allowed is one group by unit after the end date of the latest deployment. If this condition doesn't hold true, a warning is returned and the latest end date among all deployments is used. If group_by unit is NULL the end must be earlier than or equal to the end date among all deployments.

group_by

Character, one of "day", "week", "month", "year". The effort is calculated at the interval rate defined in group_by. Default: NULL: no grouping, i.e. the entire interval from start to end is taken into account as a whole. Calendar values are used, i.e. grouping by year will calculate the effort from Jan 1st up to Dec 31st for each year.

unit

Character, the time unit to use while returning custom effort. One of: hour (default), day.

datapkg

Deprecated. Use package instead.

Value

A tibble data frame with following columns:

  • deploymentID: Deployment unique identifier.

  • locationName: Location name of the deployments.

  • begin: Begin date of the interval the effort is calculated over.

  • effort: The effort as number.

  • unit: Character specifying the effort unit.

See Also

Other exploration functions: get_cam_op(), get_effort(), get_n_individuals(), get_n_obs(), get_n_species(), get_rai(), get_rai_individuals(), get_record_table(), get_scientific_name(), get_species()

Examples

# Effort for each deployment over the entire duration of the project
# (datapackage) measured in hours (default)
get_custom_effort(mica)

# Effort for each deployment expressed in days
get_custom_effort(mica, unit = "day")

# Effort for each deployment from a specific start to a specific end
get_custom_effort(
  mica,
  start = as.Date("2019-12-15"), # or lubridate::as_date("2019-12-15")
  end = as.Date("2021-01-10")
)

# Effort for each deployment at daily interval
get_custom_effort(
  mica,
  group_by = "day"
)

# Effort for each deployment at weekly interval
get_custom_effort(
  mica,
  group_by = "week"
)

# Effort for each deployment at monthly interval
get_custom_effort(
  mica,
  group_by = "month"
)

# Effort for each deployment at yearly interval
get_custom_effort(
  mica,
  group_by = "year"
)

# Applying filter(s), e.g. deployments with latitude >= 51.18, can be
# combined with other arguments
get_custom_effort(mica, pred_gte("latitude", 51.18), group_by = "month")

# You can afterwards calculate the total effort over all deployments
library(dplyr)
get_custom_effort(mica, group_by = "year", unit = "day") %>%
  dplyr::filter(effort > 0) %>%
  dplyr::group_by(begin) %>% 
  dplyr::summarise(
    deploymentIDs = list(deploymentID),
    locationNames = list(locationName),
    ndep = length(unique(deploymentID)),
    nloc = length(unique(locationName)),
    effort = sum(effort),
    unit = unique(unit)
  )

inbo/camtraptor documentation built on June 2, 2025, 5:17 a.m.