## Create a simulated vector of repeated IDs:
IDvec <- sort(sample(1:5, size = 15, replace = TRUE))
## Simulate dates (e.g., years) of observation per individual:
dVec <- rep(0, length(IDvec))
for(i in unique(IDvec)) {
svec <- which(IDvec == i)
dVec[svec] <- sort(sample(1990:1995, length(svec)))
}
## Construct the capture-recapture matrix:
Y <- CensusToCaptHist(ID = IDvec, d = dVec)
Run the code above in your browser using DataLab