| qapply {FLCore} | R Documentation |
Returns a list or FLlst containing values obtained by
applying a function to margins for each FLQuant in a composite FLR object.
qapply(X,FUN)
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.
The FLR Team
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)