detPhase {diveMove} | R Documentation |
Functions to identify sections of a TDR record displaying one of three possible activities: on-land, at-sea, and at-sea leisure.
detPhase(time, depth, landerr=65, seaerr=3605, ...) getAct(time, act, interval)
time |
chron object with date and time for all depths. |
depth |
numeric vector with depth readings. |
landerr |
land error threshold in seconds. On-land phases shorter than this threshold will be considered as at-sea. |
seaerr |
at-sea leisure threshold in seconds. At-sea phases shorter than this threshold will be considered as at-sea leisure. |
act |
A numeric vector indicating the activity for every element
of time . |
interval, ... |
sampling interval in chron units (d). |
detPhase
first creates a factor with value ‘L’
(on-land) for rows with NAs for depth
and value ‘W’
(at-sea) otherwise. It subsequently calculates the duration of each of
these phases of activity. If the duration of an on-land phase
(‘L’) is less than landerr
, then the values in the
factor for that phase are changed to ‘W’ (at-sea). The
duration of phases is then recalculated, and if the duration of a
phase of at-sea activity is less than seaerr
, then the
corresponding value for the factor is changed to ‘Z’ (at-sea
leisure). The durations of all phases are recalculated a third time
to provide final phase durations.
getAct
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.
A list with components; the first 4 are returned by
detPhase
and the rest by getAct
:
phase.id |
numeric vector identifying each activity phase, starting from 1 for every input record. |
trip.act |
factor with levels ‘L’ indicating land, ‘W’ indicating at-sea, ‘U’ for underwater (above dive criterion), ‘D’ for diving, ‘Z’ for at-sea leisure animal activities. Only ‘L’, ‘W’, and ‘Z’ are actually represented. |
trip.beg |
a numeric vector as long as the number of unique activity phases identified, representing the time (in days) since the origin set by chron to the start times for each activity phase. |
trip.end |
a numeric vector as long as the number of unique activity phases identified, representing the time (in days) since the origin set by chron to the end times for each activity phase. |
time.br |
a factor dividing the factor act in phases. |
time.peract |
duration of each phase defined by time.br . |
beg.time |
beginning time for each phase. |
end.time |
ending time for each phase. |
Sebastian P. Luque spluque@gmail.com