createAge: Creates an age matrix

View source: R/createAge.R

createAgeR Documentation

Creates an age matrix

Description

Creates an animals x intervals matrix which gives the age class for each individual at the beginning of each interval, based on the occasion of first capture and the age at first capture.

Usage

createAge(f, age, nyears, mAge=2)

Arguments

f

a vector of first capture occasions.

age

a corresponding vector with the age at first capture of each animal.

nyears

the number of years of the study; the number of intervals is nyears - 1.

mAge

the maximum age class; age is incremented by 1 each year up to mAge.

Value

An individuals x intervals matrix with the age of each individual at the beginning of each interval. Cells prior to the first capture are filled with NAs.

Author(s)

Michael Schaub

References

Schaub, M., Kéry, M. (2022) Integrated Population Models, Adademic Press, section 4.5.1.1.

Examples

data(woodchat5)
f <- getFirst(woodchat5$ch)
# Remove animals first captured on the last occasion
last <- which(f==ncol(woodchat5$ch))
f <- f[-last]
age <- woodchat5$age[-last]

x <- createAge(f, age, 20, 2)
head(x)
x[115:120,]
tail(x)

IPMbook documentation built on Aug. 22, 2023, 1:07 a.m.