Thin wrapper around assemble_matrices that standardises and stores assembled inputs in a new_invasimapr_fit object for downstream modelling. Use this function to run the input-assembly step once and pass a single structured container through subsequent pipelines.
Arguments
- ...
Arguments passed on to
assemble_matriceslong_dfOptional long-format data frame with at least the columns
site,x,y,species, andcount.site_dfOptional data frame with columns
site,x, andy, used whenlong_dfisNULL.env_dfOptional site by environment numeric data frame or matrix. Row names must correspond to site identifiers.
comm_resOptional site by resident numeric matrix or data frame (wide), or a long-format table with columns
site,species, andcount.traits_resOptional resident by trait data frame with row names corresponding to species identifiers.
comm_longCharacter string indicating how to interpret a separately supplied
comm_res; one of"auto","long", or"wide".site_col,x_col,y_col,species_col,count_colColumn names used when building from
long_df.env_colsCharacter vector of environment column names to extract.
env_prefixRegular expression used to select environment columns.
trait_colsCharacter vector of trait column names to extract.
trait_prefixRegular expression used to select trait columns.
drop_empty_sitesLogical. If
TRUE, drop sites with zero total abundance.drop_empty_speciesLogical. If
TRUE, drop resident species with zero total abundance across all sites.return_diversityLogical. If
TRUE, compute and return site-level diversity summaries.
- make_plots
Logical; if
TRUE, propagatemake_plotsto assemble_matrices so that diagnostic plots are produced during assembly. Defaults toFALSE.
Value
An object of class invasimapr_fit with components:
- inputs
The full list returned by assemble_matrices.
- meta
A list with elements
n_sites,n_residents, andn_traits.
Details
What this does
Calls assemble_matrices to build core site-by-species and site-by-trait matrices, perform consistency checks, and harmonise keys and factor levels.
Wraps the returned list into a lightweight S3 container of class
invasimapr_fit, with a dedicatedinputsslot and a smallmetablock containing basic counts used by later steps.
Object layout
invasimapr_fit
inputs : list (output from assemble_matrices)
meta : list (n_sites, n_residents, n_traits)
Notes
No mutation of the assembled inputs occurs here; the function only packages and annotates them.
To inspect the assembled data, use
fit$inputson the returned object.
