coerce-methods | R Documentation |
Objects of various FLCore classes can be converted into other classes,
both basic R ones, like data.frame
, and others defined in the package. For
the specifics of the precise calculations carried out for each pair of
classes, see below.
object |
Object to be converted. |
Class |
Name of the class to convert the object to, |
An object of the requested class.
The six dimensions of an FLArray
are converted into seven columns, named
quant
(or any other name given to the first dimension in the object),
year
, unit
, season
, area
, iter
and data
. The last one contains
the actual numbers stored in the array. units
are stored as an attribute
to the data.frame
. The year
and data
columns are of type numeric
,
while all others are factor
.
The two or more dimensions of an FLPar objects are converted into three or
more columns. For a 2D objects, they are named params, iter and data.
The last one contains the actual numbers stored in the array, in a column
type numeric
, while all others are factor
.
The FLR Team
base::as, base::coerce
# from FLQuant to data.frame
as(FLQuant(rnorm(100), dim=c(5, 20)), "data.frame")
# from FLPar to data.frame
as(FLPar(phi=rnorm(10), rho=rlnorm(10)), "data.frame")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.