FLQuant | R Documentation |
The FLQuant
class is a six-dimensional array
designed to store most quantitative data used in fisheries and population
modelling.
FLQuant(object, ...)
## S4 method for signature 'missing'
FLQuant(
object,
dim = rep(1, 6),
dimnames = "missing",
quant = NULL,
units = "NA",
iter = 1
)
## S4 method for signature 'vector'
FLQuant(
object,
dim = rep(1, 6),
dimnames = "missing",
quant = NULL,
units = "NA",
iter = 1,
fill.iter = TRUE
)
## S4 method for signature 'array'
FLQuant(
object,
dim = rep(1, 6),
dimnames = "missing",
quant = NULL,
units = "NA",
iter = 1,
fill.iter = TRUE
)
## S4 method for signature 'matrix'
FLQuant(object, dim = lapply(dimnames, length), dimnames = "missing", ...)
## S4 method for signature 'FLQuant'
FLQuant(
object,
quant = attributes(object)[["quant"]],
units = attributes(object)[["units"]],
dimnames = attributes(object)[["dimnames"]],
iter = dim(object)[6],
fill.iter = TRUE,
dim = attributes(object)[["dim"]]
)
object |
Input numeric object |
... |
Additional arguments |
dim |
Vector of dimension lengths |
dimnames |
List of dimension names |
quant |
Character vector for name of first dimension |
units |
Character vctor of units of measurement, see uom |
iter |
Number of iterations, i.e. length of the 6th dimension |
fill.iter |
Should iterations be filled with the same content as the first? |
The six dimensions are named. The name of the first dimension can be
altered by the user from its default, quant
. This could typically be
age
or length
for data related to natural populations. The
only name not accepted is 'cohort', as data structured along cohort should
be stored using the FLCohort
class instead. Other dimensions
are always names as follows: year
, for the calendar year of the
datapoint; unit
, for any kind of division of the population, e.g. by
sex; season
, for any temporal strata shorter than year; area
,
for any kind of spatial stratification; and iter
, for replicates
obtained through bootstrap, simulation or Bayesian analysis.
In addition, FLQuant
objects contain a units
attribute, of
class character
, intended to contain the units of
measurement relevant to the data.
A 6-D array for numeric data. array
.
Units of measurement. character
.
Array must have 6 dimensions
Array must be of class numeric
Dimensions 2 to 6 must be named "year", "unit", "season", "area" and "iter"
The FLQuant
method provides a flexible constructor for objects of the class.
Inputs can be of class:
vector
:A numeric vector will be placed along the year dimension by default.
matrix
:A matrix will be placed along dimensions 1 and 2, unless otherwise specified by 'dim'. The matrix dimnames will be used unless overriden by 'dimnames'.
As above
If no input is given, an empty FLQuant
(NA) is returned, but dimensions and dimnames can still be specified.
Additional arguments to the constructor:
The units of measurement, a character
string.
The dimensions of the object, a numeric
vector of length 6.
A list
object providing the dimnames of the array. Only those different from the default ones need to be specified.
The name of the first dimension, if different from 'quant', as a character
string.
The FLR Team
FLQuant
# creating a new FLQuant
flq <- FLQuant()
flq <- FLQuant(1:10, dim=c(2,5))
summary(flq)
# Vectors are used column first...
dim(FLQuant(1:10))
# ...while matrices go row first.
dim(FLQuant(matrix(1:10)))
FLQuant(matrix(rnorm(100), ncol=20))
FLQuant(array(rnorm(100), dim=c(5,2,1,1,1,10)))
FLQuant(array(rnorm(100), dim=c(5,2)), iter=10)
# working with FLQuant objects
flq <- FLQuant(rnorm(200), dimnames=list(age=1:5, year=2000:2008), units='diff')
summary(flq)
flq[1,]
flq[,1]
flq[1,1] <- 0
units(flq)
quant(flq)
plot(flq)
FLQuant()
summary(FLQuant())
FLQuant(1:10)
FLQuant(array(rnorm(9), dim=c(3,3,3)))
FLQuant(matrix(rnorm(12), nrow=4, ncol=3))
FLQuant(FLQuant(array(rnorm(9), dim=c(3,3,3)), units='kg'), units='t')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.