presence: Presence

View source: R/transformations.R

presenceR Documentation

Presence

Description

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.

Usage

presence(v, bw = 15, pass = TRUE)

Arguments

v

Dataframe. A visits data frame from the output of visits() (may contain more than one animal_id). Must contain columns animal_id, logger_id, start, and end.

bw

Numeric. The maximum number of minutes between visits for them to be considered the same event. When bw = NULL only visits to another logger are scored as a separate event.

pass

Logical. Pass 'extra' columns through the function and append them to the output.

Details

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.

Value

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)

Examples


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(.))



steffilazerte/feedr documentation built on Jan. 27, 2023, 3:46 a.m.