Gets the custom effort (deployment duration) for a custom time window and a
specific time interval such as day, week, month or year. The custom effort is also
calculated over all deployments, although filtering predicates can be applied
as well. 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
. IfNULL
the earliest start date among all deployments is used. Ifgroup_by
unit is notNULL
, 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. Ifgroup_by
unit isNULL
the start must be later than or equal to the start date among all deployments.- end
End date. Default:
NULL
. IfNULL
the latest end date among all deployments is used. Ifgroup_by
unit is notNULL
, 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. Ifgroup_by
unit isNULL
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 ingroup_by
. Default:NULL
: no grouping, i.e. the entire interval fromstart
toend
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:
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
# A global effort over the entire duration of the project (datapackage)
# measured in hours
get_custom_effort(mica)
#> # A tibble: 1 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-10-09 1321. hour
# Global effort expressed in days
get_custom_effort(mica, unit = "day")
#> # A tibble: 1 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-10-09 55.0 day
# Total effort 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")
)
#> # A tibble: 1 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-12-15 457. hour
# Effort at daily interval
get_custom_effort(
mica,
group_by = "day"
)
#> # A tibble: 558 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-10-09 12.7 hour
#> 2 2019-10-10 24 hour
#> 3 2019-10-11 24 hour
#> 4 2019-10-12 24 hour
#> 5 2019-10-13 24 hour
#> 6 2019-10-14 24 hour
#> 7 2019-10-15 24 hour
#> 8 2019-10-16 24 hour
#> 9 2019-10-17 24 hour
#> 10 2019-10-18 24 hour
#> # ℹ 548 more rows
# Effort at weekly interval
get_custom_effort(
mica,
group_by = "week"
)
#> # A tibble: 81 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-10-06 84.7 hour
#> 2 2019-10-13 168 hour
#> 3 2019-10-20 82.0 hour
#> 4 2019-10-27 0 hour
#> 5 2019-11-03 0 hour
#> 6 2019-11-10 0 hour
#> 7 2019-11-17 0 hour
#> 8 2019-11-24 0 hour
#> 9 2019-12-01 0 hour
#> 10 2019-12-08 0 hour
#> # ℹ 71 more rows
# Effort at monthly interval
get_custom_effort(
mica,
group_by = "month"
)
#> # A tibble: 19 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-10-01 335. hour
#> 2 2019-11-01 0 hour
#> 3 2019-12-01 0 hour
#> 4 2020-01-01 0 hour
#> 5 2020-02-01 0 hour
#> 6 2020-03-01 0 hour
#> 7 2020-04-01 0 hour
#> 8 2020-05-01 0 hour
#> 9 2020-06-01 219. hour
#> 10 2020-07-01 66.5 hour
#> 11 2020-08-01 172. hour
#> 12 2020-09-01 0 hour
#> 13 2020-10-01 0 hour
#> 14 2020-11-01 0 hour
#> 15 2020-12-01 0 hour
#> 16 2021-01-01 0 hour
#> 17 2021-02-01 0 hour
#> 18 2021-03-01 99.4 hour
#> 19 2021-04-01 429. hour
# Effort at yearly interval
get_custom_effort(
mica,
group_by = "year"
)
#> # A tibble: 3 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2019-01-01 335. hour
#> 2 2020-01-01 457. hour
#> 3 2021-01-01 529. hour
# Applying filter(s), e.g. deployments with latitude >= 51.18
get_custom_effort(mica, pred_gte("latitude", 51.18))
#> df %>% dplyr::filter((latitude >= 51.18))
#> # A tibble: 1 × 3
#> begin effort unit
#> <date> <dbl> <chr>
#> 1 2020-06-19 457. hour