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 Date format.

start_dates

Vector of dates in Date format that define the start of each season.

end_dates

Vector of dates in Date format that define the end of each season.

Value

A matrix with 1 + no. seasons rows and columns.

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
)



[Package wpeR version 0.1.0 Index]