backwards {mort} | R Documentation |
Shift start time of potential mortalities earlier
Description
Shift the start time of potential mortalities earlier, if station/location has not changed.
Usage
backwards(data, morts, ID, station, res.start, stnchange = NULL)
Arguments
data |
a dataframe of residence events. Residence events must include tag ID, location name, start time, and duration. Residence events should be continuous (i.e., not subset by season). |
morts |
a dataframe containing potential mortalities. Must use
#' the same column names and in the same order as |
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 |
stnchange |
a dataframe with the start time and location of the most
recent station or location change. Must use the same column names and in
the same order as |
Value
a dataframe with one row for each tag ID, including the date/time of
the residence start when the potential mortality or expelled tag was identified.
Returns the input morts
dataframe if no potential mortalities are shifted
earlier.
All input data fields
(e.g., any name, location, or species information that was included with the
input data) will be retained.
Examples
morts<-morts(data=events,type="mort",ID="ID",station="Station.Name",
method="any")
head(morts)
# If station change not identified yet:
morts_bw<-backwards(data=events,morts=morts,ID="ID",
station="Station.Name",res.start="ResidenceStart")
head(morts_bw)
# Identify station change first:
station.change<-stationchange(data=events,type="mort",
ID="ID",station="Station.Name")
morts_bw<-backwards(data=events,morts=morts,ID="ID",
station="Station.Name",res.start="ResidenceStart",
stnchange=station.change)
head(morts_bw)