R/classes.R
, R/generics.R
, R/utilities.R
, and 1 more
fwdControl.Rd
The desired targets, limits and time steps used in fishery projections can be
specified by creating an object of class fwdControl
.
Constructor for fwdControl objects. Bare bones man pages. Better to look at the vignettes and tutorials.
fwdControl(target, iters, ...)
G(...)
# S4 method for class 'data.frame,array'
fwdControl(target, iters, ...)
# S4 method for class 'data.frame,numeric'
fwdControl(target, iters, ...)
# S4 method for class 'data.frame,missing'
fwdControl(target, iters, ...)
# S4 method for class 'list,missing'
fwdControl(target, iters, ...)
# S4 method for class 'list,list'
fwdControl(target, iters, ...)
# S4 method for class 'missing,missing'
fwdControl(target, iters, ...)
# S4 method for class 'FLQuant,missing'
fwdControl(target, quant, ...)
target
The table of quantities and time steps used as target, data.frame.
iters
The values and limits for each target quantity and time step, array.
FCB
The matrix describing which FLCatch of which FLFishery catches which FLBiol. A matrix with 3 columns: F, C, and B.
Neque porro quisquam est qui dolorem ipsum.
All slots in the class have accessor and replacement methods defined that allow retrieving and substituting individual slots.
The values passed for replacement need to be of the class of that slot. A numeric vector can also be used when replacing FLQuant slots, and the vector will be used to substitute the values in the slot, but not its other attributes.
A construction method exists for this class that can take named arguments for
any of its slots. All slots are then created to match the requirements of the
class validity. If an unnamed FLQuant
object is provided, this is used
for sizing but not stored in any slot.
# CREATE targets on fishing mortality ('f') by year
target <- data.frame(year=2000:2010, value=rlnorm(11), quant='f')
fwc <- fwdControl(target=target)
# INSPECT fwdControl object
show(fwc)
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2000 f NA 0.162 NA
#> 2 2001 f NA 0.781 NA
#> 3 2002 f NA 0.783 NA
#> 4 2003 f NA 0.754 NA
#> 5 2004 f NA 0.575 NA
#> 6 2005 f NA 1.876 NA
#> 7 2006 f NA 7.885 NA
#> 8 2007 f NA 0.196 NA
#> 9 2008 f NA 1.669 NA
#> 10 2009 f NA 0.155 NA
#> 11 2010 f NA 0.593 NA
# Construct from data.frame and array
fcn <- fwdControl(data.frame(year=2000:2005, quant='f', value=0.5))
# Construct a fwdControl with some targets having multiple Biols, specified using the G() function
fwdControl(list(year=2000:2001, value=200, quant="catch", biol=G(1,2)),
list(year=2002:2003, value=100, quant="catch", biol=c(1,2)))
#> An object of class "fwdControl"
#> (step) year quant biol min value max
#> 1 2000 catch 1, 2 NA 200.000 NA
#> 2 2001 catch 1, 2 NA 200.000 NA
#> 3 2002 catch 1 NA 100.000 NA
#> 4 2003 catch 2 NA 100.000 NA
# Vector of values by year
fwdControl(data.frame(year=2010:2015, quant="f", value=seq(1, 1.3, length=6)))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2010 f NA 1.000 NA
#> 2 2011 f NA 1.060 NA
#> 3 2012 f NA 1.120 NA
#> 4 2013 f NA 1.180 NA
#> 5 2014 f NA 1.240 NA
#> 6 2015 f NA 1.300 NA
# Two targets, with ranges for one
fwdControl(data.frame(year=rep(2010:2015, each=2),
quant=c("f", "catch"),
min=c(rbind(NA, 20000)), max=c(rbind(NA, 30000)),
value=c(rbind(seq(1, 1.3, length=6), NA))))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2010 f NA 1.000 NA
#> 2 2010 catch 20000.000 NA 30000.000
#> 3 2011 f NA 1.060 NA
#> 4 2011 catch 20000.000 NA 30000.000
#> 5 2012 f NA 1.120 NA
#> 6 2012 catch 20000.000 NA 30000.000
#> 7 2013 f NA 1.180 NA
#> 8 2013 catch 20000.000 NA 30000.000
#> 9 2014 f NA 1.240 NA
#> 10 2014 catch 20000.000 NA 30000.000
#> 11 2015 f NA 1.300 NA
#> 12 2015 catch 20000.000 NA 30000.000
# Single target value
fwdControl(list(year=2010:2014, quant='catch', value=2900))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2010 catch NA 2900.000 NA
#> 2 2011 catch NA 2900.000 NA
#> 3 2012 catch NA 2900.000 NA
#> 4 2013 catch NA 2900.000 NA
#> 5 2014 catch NA 2900.000 NA
# One value per target (year)
fwdControl(list(year=2010:2014, quant='catch', value=seq(2900, 3500, length=5)))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2010 catch NA 2900.000 NA
#> 2 2011 catch NA 3050.000 NA
#> 3 2012 catch NA 3200.000 NA
#> 4 2013 catch NA 3350.000 NA
#> 5 2014 catch NA 3500.000 NA
# With 40 values (iters) in each target
fwdControl(list(year=2010:2014, quant='catch',
value=rnorm(200, seq(2900, 3500, length=5))))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2010 catch NA 2899.967(0.898) NA
#> 2 2011 catch NA 3050.145(0.811) NA
#> 3 2012 catch NA 3200.465(0.896) NA
#> 4 2013 catch NA 3350.279(1.018) NA
#> 5 2014 catch NA 3499.708(1.001) NA
#> iters: 40
#>
# lapply can be used to constructs a list
fwdControl(lapply(2005:2020, function(x) list(quant="catch",
value=runif(1, 1e5, 1e6), year=x)))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2005 catch NA 694970.011 NA
#> 2 2006 catch NA 816625.531 NA
#> 3 2007 catch NA 165888.219 NA
#> 4 2008 catch NA 896268.596 NA
#> 5 2009 catch NA 844030.339 NA
#> 6 2010 catch NA 753187.563 NA
#> 7 2011 catch NA 430596.120 NA
#> 8 2012 catch NA 571085.575 NA
#> 9 2013 catch NA 522891.021 NA
#> 10 2014 catch NA 188709.747 NA
#> 11 2015 catch NA 564431.419 NA
#> 12 2016 catch NA 504760.445 NA
#> 13 2017 catch NA 594515.393 NA
#> 14 2018 catch NA 684555.571 NA
#> 15 2019 catch NA 243131.343 NA
#> 16 2020 catch NA 364375.713 NA
fwdControl(lapply(2005, function(x) list(quant="catch",
value=runif(1, 1e5, 1e6), year=x)))
#> An object of class "fwdControl"
#> (step) year quant min value max
#> 1 2005 catch NA 902156.380 NA
# FLQuant, needs 'quant' name
fwdControl(FLQuant(0.2, dimnames=list(year=2000)), quant="fbar")
#> An object of class "fwdControl"
#> (step) year quant biol min value max
#> 1 2000 fbar 1 NA 0.200 NA