assorted-methods: Assorted methods needed by FLa4a

assorted methodsR Documentation

Assorted methods needed by FLa4a

Description

Assorted methods needed by FLa4a

Assorted methods needed by FLa4a

Usage

getYidx(object, ...)

## S4 method for signature 'FLQuant'
getYidx(object, year)

is.empty(object)

niters(object, ...)

## S4 method for signature 'FLModelSim'
niters(object)

## S4 method for signature 'a4aGr'
niters(object)

## S4 method for signature 'a4aStkParams'
dims(obj)

replaceZeros(object, ...)

## S4 method for signature 'FLQuant'
replaceZeros(object, fraction = 0.25)

## S4 method for signature 'FLStock'
replaceZeros(object, fraction = 0.25)

## S4 method for signature 'FLIndex'
replaceZeros(object, fraction = 0.25)

## S4 method for signature 'FLIndices'
replaceZeros(object, fraction = 0.25)

Arguments

object

object of relevant class (see signature of method)

...

additional argument list that might never be used

year

numeric with year to be extracted

obj

an object

fraction

numeric with fraction of minimum to replace zeros

getYidx

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.

is.empty

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.

niters

Compute number of iterations. Takes an object of any FLR class and returns a numeric.

dims

Extracts the dims of the parameters.

replaceZeros

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.

Examples

#Example use of getYidx:
data(ple4)
flq <- catch(ple4)
getYidx(flq, 2000:2004)
flq[, getYidx(flq, 2000:2004)]
#Example use of is.empty:
is.empty(list())
is.empty(list(a=2))
#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)
#Example use of dims:
dims(FLPar())
#Example use of getYidx:
data(ple4)
flq <- catch(ple4)
flq <- replaceZeros(flq, 0.25)
catch(ple4) <- flq

flr/FLa4a documentation built on June 4, 2023, 11:05 a.m.