Learn R Programming

r4ss (version 1.44.0)

SS_write: Write all Stock Synthesis input files for a model

Description

Writes all the input files for a Stock Synthesis model using the list created by SS_read() (presumably after modification of one or more elements) using the SS_write*() functions for the four or five model input files.

Usage

SS_write(inputlist, dir = "", overwrite = FALSE, verbose = FALSE)

Arguments

inputlist

list created by SS_read()

dir

A file path to the directory of interest. Typically used with file, an additional input argument, to specify input and output file paths. The default value is dir = NULL, which leads to using the current working directory, and thus, full file paths should not be specified for other arguments as they will be appended to dir.

overwrite

A logical value specifying if the existing file(s) should be overwritten. The default value is overwrite = FALSE.

verbose

A logical value specifying if output should be printed to the screen.

See Also

Examples

Run this code
# NOT RUN {
# read inputlist to modify the data file
inputlist <- SS_read(
  dir = system.file("extdata", "simple_3.30.13", package = "r4ss")
)

# modify the starter file (use the par file)
inputlist[["start"]][["init_values_src"]] <- 1

# modify the data file (remove age comps from years prior to 1990)
inputlist[["dat"]][["agecomp"]] <- inputlist[["dat"]][["agecomp"]] %>%
  dplyr::filter(Yr >= 1990)

# modify the control file (turn off early recdevs and change range of yrs)
inputlist[["ctl"]][["recdev_early_phase"]] <-
  -abs(inputlist[["ctl"]][["recdev_early_phase"]])
inputlist[["ctl"]][["MainRdevYrFirst"]] <- 1980

# write the files to a new folder within the source directory
SS_write(
  inputlist = inputlist,
  dir = file.path(inputlist[["dir"]], "modified_inputs")
)
# }

Run the code above in your browser using DataLab