R/ct-to-recurrent.R
ct_to_recurrent.Rd
Takes a camera trap dataset as input (site ID, timestamp and species name) and return a recurrent event dataset. The function creates a survey after each observation of the primary species for a defined maximum duration. Within each survey, all the observations of the secondary species are converted into recurrent events. The returned dataframe can be directly used for recurrent event analysis.
ct_to_recurrent(
data,
primary,
secondary,
survey_duration = 10,
datetime_var = "DateTime",
species_var = "Species",
site_var = "Site",
tertiary = NULL,
survey_end_date = NULL
)
A dataframe containing the site, the timestamp and the species information
character A vector of one or several species names considered to affect the secondary species
character(1) Name of the species affected by the primary (only one name allowed).
integer(1) Maximum duration of the survey (in days, e.g. "7")
Name of the variable that contains date time information.
character(1) Name of the variable that contains species information.
Name of the variable that contains Site ID.
character Names of the species in species_var
that should not be considere primary or secondary.
Date Date of study end (e.g. "01-01-2001")
A dataframe containing:
Camera-trap site ID
Survey ID
primary species starting the survey
Timestamp of the start of the survey (i.e. of the primary species observation)
Timestamp of the recurrent event (i.e. of the secondary species observation)
Time since the start of the survey
Time since the last event, which can be the primary species or a previous secondary species
Binary, 1 = recurrent event, 0 = censoring event
Event number within the survey
Either the recurrent event, giving the name of the secondary species, or a censoring event and the reason of censoring
Timestamp of survey start (primary observation)
Any covariate attached to the dataset