coerce {FLCore}R Documentation

Method coerce

Description

Coercion methods for various sets of classes are generated using the coerce function. Users should call the corresponding generated as() method, with arguments equal to the object to coerce and the name of the class to convert to.

Coercion combinations work by transferring or transforming relevant slots from the original object and placing them in a new object of the target class. The descriptions below document how slots for each pair of classes are transfered or transformed. In all cases the name and desc slots are simply copied accross.

Generic function

coerce(from, to, strict)

Methods

from=FLBiol, to=FLStock:
n to stock.n, wt to stock.wt, m to m,fec to mat,spwn to m.spwn
from=FLStock, to=FLBiol:
stock.n to n, stock.wt to wt, m to m,mat to fec,m.spwn to spwn
from=FLStock, to=FLCatch:
catch.n to catch.n, catch.wt to catch.wt, catch to catch, landings.n to landings.n, landings.wt to landings.wt, landings to landings, discards.n to discards.n, discards.wt to discards.wt, discards to discards, name to name
from=FLStock,to=FLMetier
As before but creating an FLMetier object with a single catch element.
from=FLStock,to=FLFleet
As before but creating an FLFleet object with a single metier and catch.
from=FLQuant,to=FLCohort
An FLCohort-class object is created from the year-structured data in an FLQuant. See FLCohort for a description of the exact procedure.
from=FLCohort,to=FLQuant
The previous calculation is reversed and an FLQuant is returned.
from=FLlst,to=list
An standard R list object is created from an FLlst-class by dropping the extra attributes.

Author(s)

The FLR Team

See Also

FLComp

Examples

data(ple4)
flb <- as(ple4, 'FLBiol')

[Package FLCore version 2.2 Index]