splitCH: Split/collapse capture histories

Description Usage Arguments Value Author(s) Examples

View source: R/splitCH.r

Description

splitCH will split a character string vector of capture histories into a matrix. The matrix is appended to the original data set (data) if one is specified. Will handle character and numeric values in ch. Results will differ depending on content of ch. collapseCH will collapse a capture history matrix back into a character vector. Argument can either be a capture history matrix (chmat) or a dataframe (data) that contains fields with a specified prefix.

Usage

1
2
3
splitCH(x="ch", data=NULL, prefix="Time")
 
        collapseCH(chmat=NULL, data=NULL, prefix="Time")

Arguments

x

A vector containing the character strings of capture histories or the column number or name in the data set data

data

A data frame containing columnwith value in x if x indicates a column in a data frame

prefix

first portion of field names for split ch

chmat

capture history matrix

Value

A data frame if data specified and a matrix if vector ch is specified

Author(s)

Devin Johnson; Jeff Laake

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# This example is excluded from testing to reduce package check time
data(dipper)
# following returns a matrix
chmat=splitCH(dipper$ch)
# following returns the original dataframe with the ch split into columns
newdipper=splitCH(data=dipper)
# following collapses chmat
ch=collapseCH(chmat)
# following finds fields in newdipper and creates ch
newdipper$ch=NULL
newdipper=collapseCH(data=newdipper)

RMark documentation built on Nov. 7, 2019, 1:06 a.m.

Related to splitCH in RMark...