Learn R Programming

secr (version 4.6.10)

as.data.frame: Coerce capthist to Data Frame or Array

Description

Method for generic as.data.frame function that partially reverses make.capthist.

Usage

# S3 method for capthist
as.data.frame(x, row.names = NULL, optional = FALSE, covariates = FALSE, 
                                    fmt = c("trapID", "XY"), ...)
# S3 method for traps
as.data.frame(x, row.names = NULL, optional = FALSE, usage = FALSE, 
                              covariates = FALSE, ...)
# S3 method for capthist
as.array(x, ...)

Value

A data frame or list of data frames (in the case of a multisession input).

For capthist objects --

The core columns are (Session, ID, Occasion, TrapID) or (Session, ID, Occasion, x, y), depending on the value of fmt. Additional columns for covariates and signal strength (detector `signal') are appended to the right.

For traps objects --

The core columns are (x, y). Usage columns are named u1, u2, ..., uS where S is the number of occasions.

The as.array method for capthist objects returns an object with the same dimensions and dimnames but different class, or a list of such objects in the case of multisession input.

Arguments

x

capthist object

row.names

unused argument of generic function

optional

unused argument of generic function

covariates

logical or a character vector of covariates to export

fmt

character string for capture format

usage

logical; if TRUE then usage columns are appended if present

...

other arguments (not used)

Details

By default individual covariates are not exported. When exported they are repeated for each detection of an individual.

Examples

Run this code

  as.data.frame (captdata)
  as.data.frame (traps(captdata))
  

Run the code above in your browser using DataLab