as.data.frame {secr} | R Documentation

## Coerce capthist to Data Frame

### 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, ...)

### 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.

### Examples

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

[Package secr version 3.2.1 Index]