Description Generic function Methods Author(s) See Also Examples
Subsetting of FLR objects can be carried out using the dimension names by using
trim
. A number of dimension names and selected dimensions are passed to the
method and those are used to subset the input object.
Exceptions are made for those classes where certain slots might differ in one or
more dimensions. If trim is applied on an FLQuant object of length 1 in its first
dimension and with dimension name equal to 'all', values to trim on specified for
that dimension will be ignored. For example, FLStock
objects
contain slots with length=1 on their first dimension. Specifying values to trim along
over the first dimension will have no effect on those slots (catch
,
landings
, discards
, and stock
). Calculations might need to be
carried out to recalculate those slots if their quant-structured counterparts are
modified along the first dimension.
trim(x)
Trims along the specified dimensions.
Trims along the specified dimensions.
Trims along the specified dimensions, but ignores the quant (first) dimension for those slots where it is always of length=1.
Trims along the specified dimensions.
Trims along the specified dimensions, but ignores the quant (first) dimension for thoe slots where it is of length=1.
The FLR Team
FLQuant, FLStock, FLCohort, FLIndex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(ple4)
# This is equivalent to window(catch(ple4), start=1990, end=1995)
trim(catch(ple4), year=1990:1995)
trim(catch.n(ple4), year=1990:1995, age=1:2)
# Now on an FLStock
summary(trim(ple4), year=1990:1995)
# If 'age' is trimmed in ple4, catch, landings and discards need to be recalculated
shpl4 <- trim(ple4, age=1:4)
landings(shpl4) <- computeLandings(shpl4)
discards(shpl4) <- computeDiscards(shpl4)
catch(shpl4) <- computeCatch(shpl4)
summary(shpl4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.