This function resamples species data frames, runs species distribution models (SDMs) in parallel, and saves the results.

resample_tests(
  spp_dfs,
  spp_info,
  grid_yrs,
  dir_out,
  test = FALSE,
  parallel = FALSE,
  n_knots = 500,
  model_type = "wrapper_sdmtmb"
)

Arguments

spp_dfs

A list of species data frames.

spp_info

A data frame containing information about the test species.

grid_yrs

A data frame or list containing grid years information.

dir_out

A character string specifying the directory for output files.

test

Logical. Default = FALSE. If TRUE, will only run first two resampling tests.

parallel

Logical. Default = FALSE. If TRUE, will run models using furrr::future_map().

n_knots

Numeric. Default = 500.

model_type

String. Default = "wrapper_sdmtmb", but can be any preset wrapper_*() function or a premade home built function.

Details

This function performs the following steps:

  • Sets up directories for output files.

  • Reduces the list of data frames to the last two entries for testing purposes.

  • Saves each data frame in Parquet format.

  • Sets up parallel processing using the furrr package.

  • Runs species distribution models (SDMs) in parallel.

  • Saves the results of the SDM processing into CSV files.

Examples

if (FALSE) { # \dontrun{
resample_tests() # TO DO: NEED EXAMPLE OF HOW TO USE
} # }