Skip to contents

Thin wrapper around assemble_matrices() that standardises and stores the assembled inputs in an invasimapr_fit object for downstream modelling. Use this to run the input-assembly step once and pass a single structured object through subsequent pipelines.

Usage

prepare_inputs(..., make_plots = FALSE)

Arguments

make_plots

logical. If TRUE, propagate make_plots to assemble_matrices() so that diagnostic plots are produced during assembly. Defaults to FALSE.

Value

An object of class invasimapr_fit with components:

inputs

The full list returned by assemble_matrices().

meta

A list with n_sites, n_residents, n_traits.

Details

What this does

  1. Calls assemble_matrices() to build core site × species/trait matrices, perform consistency checks, and harmonise keys and factor levels.

  2. Wraps the returned list (core) into a lightweight S3 container invasimapr_fit with a dedicated inputs slot and a small meta block (counts of sites, residents, traits) 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 core object occurs here; this function only packages and annotates it.

  • If you need to inspect the assembled inputs, use fit$inputs after return.

See also

Examples

if (FALSE) { # \dontrun{
# Minimal pattern; pass the same arguments you would to assemble_matrices()
fit <- prepare_inputs(
  sites      = site_df,
  residents  = resident_df,
  invaders   = invader_df,
  traits     = trait_df,
  make_plots = TRUE
)
str(fit, 1)
str(fit$inputs, 1)
fit$meta
} # }