Identify the most recent station or location change from passive acoustic telemetry data.

stationchange(
  data,
  type = "mort",
  ID,
  station,
  res.start = "auto",
  res.end = "auto",
  residences = "auto",
  singles = TRUE,
  drift = FALSE,
  ddd = NULL,
  units = NULL,
  from.station = NULL,
  to.station = NULL,
  verbose = TRUE
)

Arguments

data

a dataframe of residence events. Residence events must include tag ID, location name, start time, and duration.

type

the method used to generate the residence events. Options are "mort", "actel", "glatos", "vtrack", or "manual". If "manual", then user must specify ID, station, res.start, and residences.

ID

a string of the name of the column in data that holds the tag or sample IDs.

station

a string of the name of the column in data that holds the station name or receiver location.

res.start

a string of the name of the column in data that holds the start date and time. Must be specified and in POSIXt if type="manual".

res.end

a string of the name of the column in data that holds the end date and time. Must be specified and in POSIXt or character in the format YYYY-mm-dd HH:MM:SS if type="manual".

residences

a character string with the name of the column in data that holds the duration of the residence events.

singles

specifies if single detections (length of residence event = 0) should be retained. Default is TRUE.

drift

option to account for potential drifting in identifying station changes.

ddd

a dataframe of stations/locations where detected movement between stations may be due to drifting of an expelled tag or dead animal.

units

optional units of the duration of the residence events in data. Required if drift=TRUE. Options are "auto", or "secs", "mins", "hours", "days", or "weeks".

from.station

a string of the name of the column in ddd that contains the station/location names where drifting detections may start from. Must be identical to the station/location names in data.

to.station

a string of the name of the column in ddd that contains the station/location names where drifting detections may move to. Must be identical to the station/location names in data.

verbose

option to display progress bar as function is run. Default is TRUE.

Value

a dataframe with one row for each tag ID, including the date/time of the residence start at the most recent station or location, the date/time of the residence end, and duration of the residence event. All input data fields (e.g., any name, location, or species information that was included with the input data) will be retained.

Examples

stn.change<-stationchange(data=events,type="mort",ID="ID",station="Station.Name",verbose=FALSE)
head(stn.change)
#>          ResidenceStart Station.Name ID        ResidenceEnd
#> 35  2005-06-25 21:26:12           10  A 2005-06-26 09:01:17
#> 36  2005-07-01 05:28:31            1  B 2005-07-01 05:28:31
#> 91  2004-06-19 15:31:47            9  C 2004-06-19 19:10:01
#> 93  2004-08-31 16:48:00            5  D 2004-08-31 17:38:18
#> 101 2004-07-15 21:09:22            5  E 2004-10-12 21:44:11
#> 106 2005-06-28 21:12:58            1  F 2005-10-09 20:28:05
#>     ResidenceLength.days
#> 35            0.48269676
#> 36            0.00000000
#> 91            0.15155093
#> 93            0.03493056
#> 101          89.02417824
#> 106         102.96883102