View source: R/transformations.R
presence | R Documentation |
Turns multiple visits at specific loggers into overall presence events. Presence is different from a visit in that a visit is considered a specific period of time in which the individual was in range of a logger to the exclusion of others. In contrast, presence reflects a period of time where the individual was making regular visits to the logger but not necessarily in range at all times, or to the exclusion of other individuals. Presence can be considered a less precise 'smoothing' of the data.
presence(v, bw = 15, pass = TRUE)
v |
Dataframe. A visits data frame from the output of |
bw |
Numeric. The maximum number of minutes between visits for them to
be considered the same event. When |
pass |
Logical. Pass 'extra' columns through the function and append them to the output. |
The start and end of a period of presence is determined by either switching
loggers (when bw = NULL
) or by both switching loggers and by a cutoff
time of bw
minutes.
A data frame of presence events. This data frame has the following columns:
ID of the animal (animal_id
)
ID of the logger(logger_id
)
Time of the start of the event (start
)
Time of the end of the event (end
)
v <- visits(finches) p <- presence(v) # Summarize a movement dataframe (get total time present per logger per animal) library(dplyr) p_totals <- p %>% group_by(animal_id, logger_id) %>% summarize(length = sum(length)) # Calculate across different experiments (expect warnings about unequal factor levels): library(dplyr) v <- chickadees %>% group_by(experiment) %>% do(visits(.)) p <- v %>% group_by(experiment) %>% do(presence(.))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.