View source: R/ct_to_occupancy.R
| ct_to_occupancy | R Documentation |
This function transforms camera trap detection data into an occupancy format suitable for analysis. It aggregates detections into user-defined time windows and optionally converts counts into presence-absence (0/1) data.
ct_to_occupancy(
data,
date_column,
format = "%Y-%m-%d",
site_column,
species_column,
size_column,
by_day = 7,
presence_absence = TRUE
)
data |
A data frame containing camera trap detection records. |
date_column |
The name of the column containing detection dates. |
format |
a character string. If not specified when converting from a
character representation, it will try c("%Y-%m-%d", "%Y/%m/%d") one by one,
and give an error if none works. Otherwise, the processing is
via |
site_column |
The name of the column identifying sampling sites. |
species_column |
The name of the column containing species names. Can be NULL if species information is not needed. |
size_column |
The name of the column representing detection counts. |
by_day |
An integer specifying the number of days per time window (default: |
presence_absence |
Logical. If |
A wide-format data frame where rows represent sites (and optionally species), and columns represent detection windows. Values indicate either detection counts or presence-absence (0/1).
ct_to_community()
data <- data.frame(
date = c("01-01-2023", "03-01-2023", "10-01-2023", "15-01-2023"),
site = c("A", "A", "B", "B"),
species = c("Tiger", "Tiger", "Deer", "Deer"),
count = c(1, 2, 3, 1)
)
occupancy_data <- ct_to_occupancy(
data,
date_column = date,
site_column = site,
species_column = species,
size_column = count,
by_day = 7,
presence_absence = TRUE
)
occupancy_data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.