-
Notifications
You must be signed in to change notification settings - Fork 1
/
ct_to_recurrent.Rd
60 lines (52 loc) · 2.47 KB
/
ct_to_recurrent.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ct-to-recurrent.R
\name{ct_to_recurrent}
\alias{ct_to_recurrent}
\title{Convert camera trap data into a recurrent event format}
\usage{
ct_to_recurrent(
data,
primary,
secondary,
survey_duration = 10,
datetime_var = "DateTime",
species_var = "Species",
site_var = "Site",
tertiary = NULL,
survey_end_date = NULL
)
}
\arguments{
\item{data}{A dataframe containing the site, the timestamp and the species information}
\item{primary}{character A vector of one or several species names considered to affect the secondary species}
\item{secondary}{character(1) Name of the species affected by the primary (only one name allowed).}
\item{survey_duration}{integer(1) Maximum duration of the survey (in days, e.g. "7")}
\item{datetime_var}{Name of the variable that contains date time information.}
\item{species_var}{character(1) Name of the variable that contains species information.}
\item{site_var}{Name of the variable that contains Site ID.}
\item{tertiary}{character Names of the species in \code{species_var} that should not be considere primary or secondary.}
\item{survey_end_date}{Date Date of study end (e.g. "01-01-2001")}
}
\value{
A dataframe containing:
\describe{
\item{Site}{Camera-trap site ID}
\item{ID}{Survey ID}
\item{primary}{primary species starting the survey}
\item{datetime_primary}{Timestamp of the start of the survey (i.e. of the primary species observation)}
\item{DateTime}{Timestamp of the recurrent event (i.e. of the secondary species observation)}
\item{t.start}{Time since the start of the survey}
\item{t.stop}{Time since the last event, which can be the primary species or a previous secondary species}
\item{event}{Binary, 1 = recurrent event, 0 = censoring event}
\item{enum}{Event number within the survey}
\item{Event_type}{Either the recurrent event, giving the name of the secondary species, or a censoring event and the reason of censoring}
\item{datetime_primary}{Timestamp of survey start (primary observation)}
\item{...}{Any covariate attached to the dataset}
}
}
\description{
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.
}