dyn_matrix {wpeR} | R Documentation |
Get matrix of apparent survival
Description
Creates a matrix that shows number of captured animals between multiple seasons.
Usage
dyn_matrix(animal_id, capture_date, start_dates, end_dates)
Arguments
animal_id |
A column in the dataframe of all samples that stores individual animal identifier code. |
capture_date |
A column in the dataframe of all samples that stores
the date of sample collection. Must be in |
start_dates |
Vector of dates in |
end_dates |
Vector of dates in |
Value
A matrix with 1 + no. seasons rows and columns.
diagonal: number of new captures in each session,
above diagonal: number of recaptures from season x to season y,
below diagonal: number of animals from season y that skipped season x.
Season x is defined in first row, season y in first column.
Column Tot. Capts
gives all detected individuals in season y.
Row Tot. Skipped
gives all individuals skipped in season x but detected
later.
Examples
# Define start and end dates for sampling seasons.
seasons <- data.frame(
start = c(
as.Date("2017-01-01"),
as.Date("2018-01-01"),
as.Date("2019-01-01")
),
end = c(
as.Date("2017-12-31"),
as.Date("2018-12-31"),
as.Date("2019-12-31")
)
)
# Create a dynamics matrix for animal captures.
dyn_matrix(
animal_id = wolf_samples$AnimalRef,
capture_date = wolf_samples$Date,
start_dates = seasons$start,
end_dates = seasons$end
)