Select or modify iterations of an FLR object
Details
To extract or modify a subset of the iterations contained in an FLR object,
the iter
and iter<-
methods can be used.
In complex objects with various FLQuant
slots, the iter
method
checks whether individual slots contain more than one iteration, i.e.
dims(object)[6] > 1
. If a particular slot contains a single
iteration, that is returned, otherwise the chosen iteration is selected.
This is in contrast with the subset operator [
, which does not carry
out this check.
For objects of class FLModel
, iters are extracted for slots of
classes FLQuant
, FLCohort
and FLPar
.
Examples
# For an FLQuant
flq <- FLQuant(rnorm(800), dim=c(4,10,2), iter=10)
iter(flq, 2)
#> An object of class "FLQuant"
#> , , unit = 1, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6
#> 1 -0.5048237 -1.3370868 0.3798616 0.8791925 -3.1336722 -1.0144370
#> 2 -0.5596637 -0.2802463 -1.6543820 -0.6447686 0.9600912 0.9711411
#> 3 -1.4748116 -0.4185802 -0.2433424 -0.1750687 0.5121443 0.6914782
#> 4 0.1142472 -0.1908464 -0.0687061 -0.0374347 0.8031520 1.8676465
#> year
#> quant 7 8 9 10
#> 1 1.5428187 2.2608181 0.3993638 -1.3137536
#> 2 0.2638494 0.2034165 0.3875471 0.9533201
#> 3 -1.0138326 0.5083950 1.2421149 -0.0057127
#> 4 -0.1583943 -0.7373913 -0.3855133 2.7211215
#>
#> , , unit = 2, season = all, area = unique
#>
#> year
#> quant 1 2 3 4 5 6
#> 1 -1.2569187 0.0330401 -1.6387090 0.1192605 -0.3673764 -1.0338097
#> 2 0.3584963 0.7823388 0.2322345 -0.3333425 0.3675313 -1.4752217
#> 3 -1.1555458 -0.1553402 1.1350204 0.1012572 1.1576973 0.2932451
#> 4 -0.4511899 -0.4406116 0.7810323 0.2817826 -0.9448759 -0.0179001
#> year
#> quant 7 8 9 10
#> 1 -0.0789295 0.0827085 -0.1799535 -0.8361098
#> 2 0.5615524 -0.3081643 -0.0739701 0.6470322
#> 3 -0.4179924 1.7900058 0.8849657 0.0557016
#> 4 1.8326555 -0.0346654 -2.9268645 0.4508651
#>
#> units: NA
# For the more complex FLStock object
data(ple4)
fls <- propagate(ple4, 10)
# Extraction using iter...
fls2 <- iter(fls, 2)
summary(fls2)
#> An object of class "FLStock"
#>
#> Name: PLE
#> Description: Plaice in IV. ICES WGNSSK 2018. FLAAP
#> Quant: age
#> Dims: age year unit season area iter
#> 10 61 1 1 1 1
#>
#> Range: min max pgroup minyear maxyear minfbar maxfbar
#> 1 10 10 1957 2017 2 6
#>
#> Metrics:
#> rec: 367450 - 4303680 (1000)
#> ssb: 203391 - 913290 (t)
#> catch: 78360 - 315245 (t)
#> fbar: 0.20 - 0.72 (f)