Learn R Programming

ss3sim (version 0.9.0)

verify_input: Verify and standardize SS3 input files

Description

This function verifies the contents of operating model (om) and estimation model (em) folders. If the contents are correct, the .ctl and .dat files are renamed to standardized names and the starter.ss file is updated to reflect these names. If the contents are incorrect then a warning is issued and the simulation is aborted.

Usage

verify_input(model_dir, type = c("om", "em"))

Arguments

model_dir
Directory name for model. This folder should contain the .ctl, .dat, files etc.
type
One of "om" or "em" for operating or estimating model.

Value

  • Returns a version of the folder with sanitized files or an error if some files are missing.

Details

This is a helper function to be used within the larger wrapper simulation functions.

Examples

Run this code
# Create a temporary folder for the output:
temp_path <- file.path(tempdir(), "ss3sim-verify-example")
dir.create(temp_path, showWarnings = FALSE)

d <- system.file("extdata", package = "ss3sim")

om <- paste0(d, "/models/cod-om")
em <- paste0(d, "/models/cod-em")

file.copy(om, temp_path, recursive = TRUE)
file.copy(em, temp_path, recursive = TRUE)

# Verify the correct files exist and change file names:
verify_input(model_dir = paste0(temp_path, "/cod-om"), type = "om")
verify_input(model_dir = paste0(temp_path, "/cod-em"), type = "em")
unlink(temp_path, recursive = TRUE)

Run the code above in your browser using DataLab