View source: R/transformations.R
visits | R Documentation |
Raw data from RFID loggers contain multiple reads per individual simply
because the individual sat there long enough. In visits()
these reads
are collapsed into one visit.
visits( r, bw = 3, allow_imp = FALSE, bw_imp = 2, na_rm = FALSE, pass = TRUE, allow.imp, na.rm )
r |
Dataframe. Contains raw reads from an RFID reader with colums
|
bw |
Numerical. The minimum interval, in seconds, between reads for two successive reads to be considered separate visits. |
allow_imp |
Logical. Whether impossible visits should be allowed (see details). |
bw_imp |
Numerical. The minimum number of seconds required to travel between loggers. If quicker, visits considered impossible. |
na_rm |
Logical. Whether NA values should be automatically omited. Otherwise an error is returned. |
pass |
Logical. Pass 'extra' columns through the function and append them to the output. |
allow.imp, na.rm |
Depreciated. |
Visits are defined by three pieces of data:
How much time has passed between reads (bw
)
A change in identity between two successive reads (animal_id
)
A change in logger for a single individual (logger_id
)
The function will return an error if impossible visits are detected (unless
allow_imp = TRUE
) . A visit is deemed impossible if a single animal
travels between loggers in less time than specified by bw
.
A data frame with visits specifying animal_id
and
logger_id
as well as the start
and end
of the visit.
Any extra columns that are unique at the level of animal_id or logger_id will
also be passed through (i.e. age, sex, logger location, etc.).
v <- visits(finches) head(v) v <- visits(finches, bw = 30) head(v) # Calculate across different experiments: library(dplyr) v <- chickadees %>% group_by(experiment) %>% do(visits(.))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.