Transforms a performance statistics data.table, or an FLmse/FLmses object, into one or more FLCore::FLQuant objects organized by management procedure, with statistics in the first (quant) dimension and iterations preserved in the iter dimension.

performanceFLQuant(x)

performanceFLQuants(x)

Arguments

x

An object of class mse::FLmse, mse::FLmses, or a data.table. When x is an FLmse or FLmses, the performance slot is extracted automatically via mse::performance(). When x is a data.table, it must contain at least the columns statistic, year, iter, data, and mp. An optional biol column — present in outputs from mse::mp() on FLombf operating models — is mapped to the unit dimension of the resulting FLCore::FLQuant.

Value

performanceFLQuants()

A named list of FLCore::FLQuant objects, one per unique mp value. The first (quant) dimension is named by statistic; year and iter dimensions correspond to simulation years and iterations. When a biol column is present its values populate the unit dimension.

performanceFLQuant()

If the list contains exactly one element, that FLCore::FLQuant is returned directly; otherwise the full named list is returned.

Details

performanceFLQuants() always returns a named list (one FLQuant per MP). performanceFLQuant() is a convenience wrapper that unwraps the list when only one MP is present.

Conversion from data.table to FLQuant is delegated to FLCore::as.FLQuant(), which expects the columns to map unambiguously onto the standard FLQuant dimensions. The statistic column populates the quant dimension and must therefore contain values meaningful as dimension names.

When a biol column is present, data.table::setnames() renames it to unit before passing to FLCore::as.FLQuant(), leaving the original table unmodified.

An informative error is raised if x is a data.table that does not contain all required columns (statistic, year, iter, data, mp).

Functions

  • performanceFLQuants(): Convenience wrapper returning a single FLCore::FLQuant directly when only one management procedure is present, or the full named list otherwise.

See also

Author

Iago MOSQUEIRA iago.mosqueira@wur.nl

Examples

if (FALSE) { # \dontrun{
# From an FLmse object
flqs <- performanceFLQuants(mse_run)

# From a pre-read data.table (multiple MPs)
dat <- readPerformance()
flqs <- performanceFLQuants(dat)
flqs[["MP1"]]["SSB", , , , ,]

# Convenience wrapper — returns FLQuant directly for a single MP
flq <- performanceFLQuant(dat)
} # }