dive_stats {tagtools}R Documentation

Compute summary statistics for dives or flights

Description

Given a depth/altitude profile and a series of dive/flight start and end times, compute summary dive statistics.

Usage

dive_stats(
  P,
  X = NULL,
  dive_cues,
  sampling_rate = NULL,
  prop = 0.85,
  angular = FALSE,
  X_name = NULL,
  na.rm = TRUE
)

Arguments

P

Depth data. A vector (or one-column matrix), or a tag sensor data list.

X

(optional) Another data stream (as a vector (or a one-column matrix) or a tag sensor data list) for which to compute mean and variability. If angular is TRUE, interpreted as angular data (for example pitch, roll, or heading) and means and variances are computed accordingly. The unit of measure must be radians (NOT degrees). Currently, X must be regularly sampled.

dive_cues

A two-column data frame or matrix with dive/flight start times in the first column and dive/flight end times in the second. May be obtained from find_dives. Units should be seconds since start of tag recording.

sampling_rate

(optional and ignored if P or X are tag sensor data lists) Sampling rate of P (and X, if X is given). If omitted, then input data must be sensor data lists. If one value is given and both P and X are input, they are assumed to have the same sampling rate. If P and X have different sampling rates, then this input can have two elements (first for P, second for X).

prop

The proportion of the maximal excursion to use for defining the "destination" phase of a dive or flight. For example, if prop is 0.85 (the default), then the destination phase lasts from the first to the last time depth/altitude exceeds 0.85 times the within-dive maximum.

angular

Is X angular data? Defaults to FALSE.

X_name

A short name to use for X variable in the output data frame. For example, if X is pitch data, use X_name='pitch' to get outputs column names like mean_pitch, etc. Defaults to 'angle' for angular data and 'aux' for non-angular data.

na.rm

Logical, default is TRUE. If TRUE, then returned mean values ignore missing values, computing an average over all non-missing observations.

Details

In addition to the maximum excursion and duration, dive_stats divides each excursion into three phases: "to" (descent for dives, ascent for flights), "from" (ascent for dives, descent for flights), and "destination". The "destination" (bottom for dives and top for flights) phase of the excursion is identified using a "proportion of maximum depth/altitude" method, whereby for example the bottom phase of a dive lasts from the first to the last time the depth exceeds a stated proportion of the maximum depth. Average vertical velocity is computed for the to and from phases using a simple method: total depth/altitude change divided by total time. If an angular data variable is also supplied (for example, pitch, roll or heading), then the circular mean (computed via circ.mean) and variance (computed via circ.disp and reporting the var output) are also computed for each dive phase and the dive as a whole.

Value

A data frame with one row for each dive/flight and columns as detailed below. All times are in seconds, and rates in units of x/sec where x is the units of P.

See Also

find_dives


[Package tagtools version 0.2.0 Index]