Select or modify iterations of an FLR object

iter(obj, ...)

# S4 method for FLArray
iter(obj, iter)

# S4 method for vector
iter(obj, iter)

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.

Generic function

iter(object) iter<-(object,value)

See also

FLComp, FLQuant

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.0641408 -0.3378123 -0.7833894 0.7958809 -0.2795572 -0.6975664 #> 2 1.0926157 0.7412681 0.4876565 -0.9671092 0.1622208 -0.9527497 #> 3 -0.4956306 1.2272077 -1.7749319 0.5022352 -0.9734513 -0.6268597 #> 4 1.6344379 0.7826195 0.9487915 0.4144040 -1.6465950 -0.4579909 #> year #> quant 7 8 9 10 #> 1 -1.2194915 -0.1235022 1.1524004 0.8300625 #> 2 -0.7114728 0.4461416 0.7887216 1.0889992 #> 3 0.5594322 -0.1720984 -1.7274023 -0.5767736 #> 4 0.3844827 -0.2249316 0.7258366 1.9040604 #> #> , , unit = 2, season = all, area = unique #> #> year #> quant 1 2 3 4 5 6 #> 1 -1.1585791 1.6818400 0.0044290 -2.0075693 0.5394229 -0.7948017 #> 2 -0.0644959 0.4358620 -0.3978058 -0.9298264 0.0656113 1.7062082 #> 3 0.8676666 0.0947744 0.5577010 -1.2657260 -0.0168055 -1.1733722 #> 4 -1.2017537 -0.7428298 -0.0045107 1.3749404 0.5529106 0.5330614 #> year #> quant 7 8 9 10 #> 1 0.0799231 0.0169757 -0.3163076 1.0406833 #> 2 -0.5707623 -1.8807513 0.3324398 -0.4743604 #> 3 -0.1720857 -0.7003778 -0.5962478 -0.0744894 #> 4 0.7972824 -0.8474453 -0.7896512 -0.9912388 #> #> units: NA
# For the more complex FLStock object fls <- FLStock(catch.n=flq, m=FLQuant(0.2, dim=c(4,10,2))) summary(fls)
#> An object of class "FLStock" #> #> Name: #> Description: #> Quant: quant #> Dims: quant year unit season area iter #> 4 10 2 1 1 10 #> #> Range: min max pgroup minyear maxyear minfbar maxfbar #> 1 4 4 1 10 1 4 #> #> catch : [ 1 10 2 1 1 1 ], units = NA #> catch.n : [ 4 10 2 1 1 10 ], units = NA #> catch.wt : [ 4 10 2 1 1 1 ], units = NA #> discards : [ 1 10 2 1 1 1 ], units = NA #> discards.n : [ 4 10 2 1 1 1 ], units = NA #> discards.wt : [ 4 10 2 1 1 1 ], units = NA #> landings : [ 1 10 2 1 1 1 ], units = NA #> landings.n : [ 4 10 2 1 1 1 ], units = NA #> landings.wt : [ 4 10 2 1 1 1 ], units = NA #> stock : [ 1 10 2 1 1 1 ], units = NA #> stock.n : [ 4 10 2 1 1 1 ], units = NA #> stock.wt : [ 4 10 2 1 1 1 ], units = NA #> m : [ 4 10 2 1 1 1 ], units = NA #> mat : [ 4 10 2 1 1 1 ], units = #> harvest : [ 4 10 2 1 1 1 ], units = NA #> harvest.spwn : [ 4 10 2 1 1 1 ], units = #> m.spwn : [ 4 10 2 1 1 1 ], units =
# Extraction using iter... fls2 <- iter(fls, 2) summary(fls2)
#> An object of class "FLStock" #> #> Name: #> Description: #> Quant: quant #> Dims: quant year unit season area iter #> 4 10 2 1 1 1 #> #> Range: min max pgroup minyear maxyear minfbar maxfbar #> 1 4 4 1 10 1 4 #> #> catch : [ 1 10 2 1 1 1 ], units = NA #> catch.n : [ 4 10 2 1 1 1 ], units = NA #> catch.wt : [ 4 10 2 1 1 1 ], units = NA #> discards : [ 1 10 2 1 1 1 ], units = NA #> discards.n : [ 4 10 2 1 1 1 ], units = NA #> discards.wt : [ 4 10 2 1 1 1 ], units = NA #> landings : [ 1 10 2 1 1 1 ], units = NA #> landings.n : [ 4 10 2 1 1 1 ], units = NA #> landings.wt : [ 4 10 2 1 1 1 ], units = NA #> stock : [ 1 10 2 1 1 1 ], units = NA #> stock.n : [ 4 10 2 1 1 1 ], units = NA #> stock.wt : [ 4 10 2 1 1 1 ], units = NA #> m : [ 4 10 2 1 1 1 ], units = NA #> mat : [ 4 10 2 1 1 1 ], units = #> harvest : [ 4 10 2 1 1 1 ], units = NA #> harvest.spwn : [ 4 10 2 1 1 1 ], units = #> m.spwn : [ 4 10 2 1 1 1 ], units =
# ...in contrast to using [ which returns an error ## Not run: fls[,,,,,2]