move: Movements

View source: R/transformations.R

moveR Documentation

Movements

Description

Turns visits to mulitple loggers into movements between loggers

Usage

move(v, all = FALSE, pass = TRUE)

Arguments

v

Dataframe. A visits data frame (may contain multiple animal_ids). From the output of visits. Must contain columns animal_id, logger_id, start, and end.

all

Logical. Should all animal_ids be returned, even if the animal made no movements? If TRUE, a data frame with NAs for all columns except animal_id will be returned, if FALSE, an empty data frame will be returned.

pass

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

Value

A data frame of movements. These are defined as the bout of time from leaving one logger to arriving at a second one. Each movement bout consists of two rows of data containing:

  • ID of the animal (animal_id)

  • Date of event (date)

  • Time of event (time)

  • The ID of loggers involved (logger_id)

  • The movement path including direction (move_dir)

  • The movement path independent of direction (move_path)

  • The 'strength' of the connection (inverse of time taken to move between; strength)

  • Information on whether left/arrived (direction)

  • The ID of a single move event for a particular individual (move_id)

  • Any extra columns passed through

Examples


v <- visits(finches)
m <- move(v)

# Summarize (divide by 2 because 2 rows per event)
library(dplyr)

m.totals <- m %>%
  group_by(animal_id, move_path) %>%
  summarize(n_path = length(move_path) /2)

# Calculate across different experiments:

v <- chickadees %>%
  group_by(experiment) %>%
  do(visits(.))

m <- v %>%
  group_by(experiment) %>%
  do(move(.))


animalnexus/feedr documentation built on Feb. 2, 2023, 1:12 a.m.