as.data.frame: Convert mizer arrays to data frames

as.data.frameR Documentation

Convert mizer arrays to data frames

Description

The as.data.frame() methods for mizer array classes turn matrix- and array-like results into tidy long-form data frames, with one row per observed combination of species, size and/or time. The numeric result is always stored in a column called value.

Usage

## S3 method for class 'ArraySpeciesBySize'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'ArrayTimeBySpecies'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'ArrayTimeBySpeciesBySize'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

An ArraySpeciesBySize, ArrayTimeBySpecies or ArrayTimeBySpeciesBySize object.

row.names

Optional and included only for compatibility with the base generic. NULL or a character vector giving the row names for the data frame.

optional

Optional and included only for compatibility with the base generic. A logical value. If TRUE, setting row names and converting column names (to syntactic names) is optional.

...

Further arguments. They are currently ignored by the mizer methods.

Details

The returned columns are:

  • ArraySpeciesBySize: w, value, Species.

  • ArrayTimeBySpecies: time, value, Species.

  • ArrayTimeBySpeciesBySize: time, Species, w, value.

If the original object has non-numeric or missing dimension names, sequential indices are used for the time or w columns. Species names are taken from the row, column or dimension names of the original object.

Value

A data frame in long format.

See Also

print(), summary(), str(), plot(), ArraySpeciesBySize(), ArrayTimeBySpecies(), ArrayTimeBySpeciesBySize()

Examples


enc <- getEncounter(NS_params)
head(as.data.frame(enc))

biomass <- getBiomass(NS_sim)
head(as.data.frame(biomass))


mizer documentation built on Aug. 24, 2026, 9:08 a.m.