assorted-methods.Rd
Assorted methods needed by FLa4a
Assorted methods needed by FLa4a
getYidx(object, ...)
# S4 method for FLQuant
getYidx(object, year)
is.empty(object)
niters(object, ...)
# S4 method for FLModelSim
niters(object)
# S4 method for a4aGr
niters(object)
# S4 method for a4aStkParams
dims(obj)
replaceZeros(object, ...)
# S4 method for FLQuant
replaceZeros(object, fraction = 0.25)
# S4 method for FLStock
replaceZeros(object, fraction = 0.25)
# S4 method for FLIndex
replaceZeros(object, fraction = 0.25)
# S4 method for FLIndices
replaceZeros(object, fraction = 0.25)
object of relevant class (see signature of method)
additional argument list that might never be used
numeric
with year to be extracted
an object
numeric
with fraction of minimum to replace zeros
Gets an FLQuant's numeric id for a vector of "years". For internal use and not very interesting for users. It takes an FLQuant
object and vector
of years and returns a numeric vector
that can be used to subset the FLQuant
.
Method is.empty
checks if an object is empty. It takes any object and returns a logical, TRUE
, if the object is of length 0.
Compute number of iterations. Takes an object of any FLR
class and returns a numeric
.
Extracts the dims of the parameters.
Replaces observations of 0 by a fraction of the minimum observed. It takes an FLQuant
object and numeric
of min fraction and returns a FLQuant
with zeros replaced to be added to the FLStock
or FLIndex
objects.
#Example use of getYidx:
data(ple4)
flq <- catch(ple4)
getYidx(flq, 2000:2004)
#> [1] 44 45 46 47 48
flq[, getYidx(flq, 2000:2004)]
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 2000 2001 2002 2003 2004
#> all 145998 128107 143807 154029 140056
#>
#> units: t
#Example use of is.empty:
is.empty(list())
#> [1] TRUE
is.empty(list(a=2))
#> [1] FALSE
#Example use of niters:
mm <- matrix(NA, ncol=3, nrow=3)
diag(mm) <- c(50, 0.001,0.001)
mm[upper.tri(mm)] <- mm[lower.tri(mm)] <- c(0.1,0.01,0.00004)
md <- ~linf*(1-exp(-k*(t-t0)))
imd <- ~t0-1/k*log(1-len/linf)
prs <- FLPar(linf=58.5, k=0.086, t0=0.001, units=c("cm","yr^-1","yr"))
vbObj <- a4aGr(grMod=md, grInvMod=imd, params=prs, vcov=mm, distr="norm")
# Generate 100 sample sets
vbObj <- mvrnorm(100,vbObj)
niters(vbObj)
#> [1] 100
#Example use of dims:
dims(FLPar())
#> $iter
#> [1] 1
#>
#> $params
#> [1] ""
#>
#Example use of getYidx:
data(ple4)
flq <- catch(ple4)
flq <- replaceZeros(flq, 0.25)
catch(ple4) <- flq