Learn R Programming

IPMbook (version 0.1.5)

createAge: 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)

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.

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.

Author

Michael Schaub

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab