qapply: Method qapply

Description Generic function Methods Author(s) See Also Examples

Description

Returns a list or FLlst containing values obtained by applying a function to margins for each FLQuant in a composite FLR object.

Generic function

qapply(X,FUN)

Methods

signature(X=FLComp,FUN=function) :

FUN is typically a function name to be searched for from the environment of the call to qapply. Additional arguments to the function are specified after the function name.

qapply enables functions to be applied easily to all FLQuants of a composite object rather than repeating the code for each one separately. In the example below the apply function is nested inside qapply to calculate averages across various dimensions for each FLQuant in an FLStock object.

Author(s)

The FLR Team

See Also

FLComp apply

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(ple4)

# returns a list containing the max value for each quant
qapply(ple4, max)

# returns a FLStock of means across all dimensions except year
qapply(ple4, apply, 2, mean, na.rm=TRUE) 

# returns an FLStock of max values across all dimensions except year and age
qapply(ple4, apply, c(1,2), max)

FLCore documentation built on May 2, 2019, 5:46 p.m.