as.data.frame {FLCore} | R Documentation

## Method as.data.frame

### Description

This method converts an FLQuant or any other FLR object composed of FLQuants into a `data.frame`.

For a single FLQuant, the `data.frame` returned has 7 columns: `quant`, `year`, `unit`, `season`, `area`, `iter` and `data`. The last column contains the actual values stored in the original object, while the first six contain the corresponding dimensions. The `year` and `data` columns are of class numeric, while the other five are of class factor.

When converting an `FLCohort-class` object, the `year` column is substituted by `cohort`.

The `data.frame` returned for complex objects, i.e. those the inherit from class `FLComp`, has an extra column, `slot`, that holds the name of the slot in the original object.

The data.frame obtained from an `FLQuants-class` object also has an extra column, named `qname`, that refers to the name of each `FLQuant` object in the list. This column is named `cname` when an `FLCohorts-class` object is converted.

Objects of class FLQuants can also be converted into a wide-format table, where data from the list elements are placed in separate colums, using model.frame,FLlst-method.

### Generic function

as.data.frame(x, row.names, optional)

### Methods

signature(x=FLQuant,row.names=ANY,optional=ANY) :
  Converts an FLQuant into a data.frame
signature(x=FLComp,row.names=missing,optional=missing) :
  Converts objects of any class inheriting from FLComp into a data.frame
signature(x=FLCatch,row.names=missing,optional=missing) :
  Converts objects of class FLCatch into a data.frame
signature(x=FLQuants,row.names=missing,optional=missing) :
  Converts objects of class FLQuants into a data.frame
signature(x=FLCohorts,row.names=missing,optional=missing) :
  Converts objects of class FLCohorts into a data.frame
signature(x=FLPar,row.names=ANY,optional=ANY) :
  Converts objects of class FLPar into a data.frame
signature(x=FLCohort,row.names=ANY,optional=ANY) :
  Converts objects of class FLCohort into a data.frame

### Author(s)

The FLR Team

### See Also

as.data.frame, model.frame, model.frame,FLlst-method

### Examples

    data(ple4)
    fdf <- as.data.frame(catch.n(ple4))
    head(fdf)
    summary(fdf)

    sdf <- as.data.frame(ple4)
    head(sdf)

[Package FLCore version 2.2 Index]