| trim {FLCore} | R Documentation |
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)
The FLR Team
FLQuant-class, FLStock-class, FLCohort-class, FLIndex-class
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)