Select residence events from specified seasons, to be used to identify potential mortalities or expelled tags. Useful when animals show strong seasonal patterns in behaviour. For example, a reduction in movement during winter may be falsely identified as a mortality, or increase the threshold use to identify mortalities, which would then cause potential mortalities to be missed.

season(
  data,
  type = "mort",
  ID,
  station,
  res.start = "auto",
  res.end = "auto",
  residences = "auto",
  units = "auto",
  season.start,
  season.end,
  overlap = TRUE,
  verbose = TRUE
)

Arguments

data

a dataframe of residence events. Residence events must include tag ID, start time, end 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 res.start, res.end, residences, and units.

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 or character in the format YYYY-mm-dd HH:MM:SS 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.

units

Units of the duration of the residence events in data. Options are "secs", "mins", "hours", "days", and "weeks".

season.start

the start date/time(s) of the period of interest. If the period of interest is the same in all study years, must be a character string in format "dd-mm". Otherwise, must be in POSIXt, or a character string in format YYYY-mm-dd HH:MM:SS.

season.end

the end date/time(s) of the period of interest. If the period of interest is the same in all study years, must be a character string in format "dd-mm". Otherwise, must be in POSIXt, or a character string in format YYYY-mm-dd HH:MM:SS.

overlap

option to include residence events that overlap either the beginning or the end of the period of interest. If TRUE, the full overlapping residence events will be retained. If FALSE, only the portion of the residence events that is within the period of interest will be retained, and residences will be recalculated, using specified units. Default is TRUE.

verbose

option to display updates and progress bars as functions is run. Default is TRUE.

Value

a dataframe in the same format as the input data, with residence events limited to the period(s) of interest.

Examples

# Seasons in format dd-mm
season.events<-season(data=events,type="mort",ID="ID",
station="Station.Name",season.start="01-06",season.end="31-10",
verbose=FALSE)
head(season.events)
#>        ResidenceStart Station.Name ID        ResidenceEnd ResidenceLength.days
#> 1 2003-09-21 23:49:45           11  A 2003-09-22 00:08:18      0.01288194 days
#> 2 2003-09-22 00:20:28            1  A 2003-09-22 00:50:36      0.02092593 days
#> 3 2003-09-24 16:56:36            1  A 2003-10-11 17:15:47     17.01332176 days
#> 4 2003-10-25 14:27:06            1  A 2003-10-25 14:59:47      0.02269676 days
#> 5 2003-10-26 16:11:13            1  A 2003-10-26 17:42:09      0.06314815 days
#> 6 2003-10-26 16:11:14        Break  A                <NA>              NA days

# Seasons in format YYYY-mm-dd HH:MM:SS
season.start<-c("2003-06-15","2004-06-21")
season.end<-c("2003-10-15","2004-10-30")
season.events<-season(data=events,type="mort",ID="ID",
station="Station.Name",season.start=season.start,season.end=season.end,verbose=FALSE)
head(season.events)
#>         ResidenceStart Station.Name ID        ResidenceEnd ResidenceLength.days
#> 1  2003-09-21 23:49:45           11  A 2003-09-22 00:08:18      0.01288194 days
#> 2  2003-09-22 00:20:28            1  A 2003-09-22 00:50:36      0.02092593 days
#> 3  2003-09-24 16:56:36            1  A 2003-10-11 17:15:47     17.01332176 days
#> 4  2003-09-24 16:56:37        Break  A                <NA>              NA days
#> 65 2003-08-31 19:18:32           11  C 2003-08-31 19:40:59      0.01559028 days
#> 66 2003-09-05 16:47:03            1  C 2003-09-05 22:59:43      0.25879630 days