Split a capture history data.frame

Share:

Description

Splits a data.frame into a matrix

Usage

1

Arguments

ch

a single-column data.frame of class character to split

Details

Mark-recapture software often requires data in split form, with each value in its own matrix cell. Here is a function to split a data.frame into a matrix with each column representing a capture occassion and each row representing an individual's capture history

Value

A matrix of 1's and 0's, a row for each individual.

Author(s)

John Waller

See Also

Collapse.CH

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#' set up variables to be used by Simulate.CH for ten individuals
N = 10 
x1 = rnorm(N) #' each trait is normally distributed

#' Run Simulate.CH with a constant recapture probability
chObj = Simulate.CH(surv.form = 1 + 0.15*x1, p.constant = 1, N = N)
str(chObj)
ch = chObj$ch #' grab our data.frame
ch #' it isn't split

Split.CH(ch) #' returns a matrix