Learn R Programming

diveMove (version 0.7-2)

detPhase: Detect phases of activity from depth readings

Description

Functions to identify sections of a TDR record displaying one of three possible activities: dry, wet, and trivial wet.

Usage

detPhase(time, depth, dry.thr, wet.thr, ...)
rleActivity(time, act, interval)

Arguments

time
POSIXct object with date and time for all depths.
depth
numeric vector with depth readings.
dry.thr
dry error threshold in seconds. Dry phases shorter than this threshold will be considered as wet.
wet.thr
wet threshold in seconds. At-sea phases shorter than this threshold will be considered as trivial wet.
act
A numeric vector indicating the activity for every element of time.
interval, ...
sampling interval in seconds.

Value

  • A list with components; the first 4 are returned by detPhase and the rest by rleActivity:
  • phase.idnumeric vector identifying each activity phase, starting from 1 for every input record.
  • activityfactor with levels L indicating dry, W indicating wet, U for underwater (above dive criterion), D for diving, Z for trivial wet animal activities. Only L, W, and Z are actually represented.
  • begina POSIXct object as long as the number of unique activity phases identified, indicating the start times for each activity phase.
  • enda POSIXct object as long as the number of unique activity phases identified, indicating the end times for each activity phase.
  • time.bra factor dividing the factor act in phases.
  • time.peractduration of each phase defined by time.br.
  • beg.timePOSIXct object; beginning time for each phase.
  • end.timePOSIXct object; ending time for each phase.

Details

detPhase first creates a factor with value L (dry) for rows with NAs for depth and value W (wet) otherwise. It subsequently calculates the duration of each of these phases of activity. If the duration of an dry phase (L) is less than dry.thr, then the values in the factor for that phase are changed to W (wet). The duration of phases is then recalculated, and if the duration of a phase of wet activity is less than wet.thr, then the corresponding value for the factor is changed to Z (trivial wet). The durations of all phases are recalculated a third time to provide final phase durations.

rleActivity takes a factor indicating different activity phases, their associated time, and the sampling interval to return a factor uniquely identifying each phase of activity, i.e. labelling them. In addition, it returns the duration of each phase, and their beginning and end times.

See Also

detDive