resmax {mort} | R Documentation |
Maximum residence duration
Description
Find the maximum duration of a single residence in the dataset that occurred before a station change (i.e., the animal can be assumed to be alive)
Usage
resmax(
data,
ID,
station,
res.start,
residences,
stnchange,
drift = FALSE,
verbose = TRUE
)
Arguments
data |
a dataframe of residence events. Residence events must include tag ID, location name, start time, and duration. |
ID |
a string of the name of the column in |
station |
a string of the name of the column in |
res.start |
a string of the name of the column in |
residences |
a character string with the name of the column in |
stnchange |
a dataframe with the start time and location of the most
recent station or location change. Must use the same column names as |
drift |
indicates if drift residence events should be included in determining the maximum residence duration |
verbose |
option to display progress bar as function is run. Default is TRUE. |
Value
a dataframe with the residence information for the longest residence for each tag ID that occurred before the most recent station/location change.
Examples
# Identify most recent station change
station.change<-stationchange(data=events,type="mort",ID="ID",
station="Station.Name",verbose=FALSE)
longest_res_events<-resmax(data=events,ID="ID",station="Station.Name",
res.start="ResidenceStart",residences="ResidenceLength.days",
stnchange=station.change,verbose=FALSE)
head(longest_res_events)