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

as.data.frameR Documentation

Coerce capthist to Data Frame or Array

Description

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

Usage


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

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.

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.

Examples


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

secr documentation built on Nov. 4, 2024, 9:06 a.m.