SS_write | R Documentation |
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 to
six model input files.
SS_write(inputlist, dir = "", overwrite = FALSE, verbose = FALSE)
inputlist |
list created by |
dir |
A file path to the directory of interest.
The default value is |
overwrite |
A logical value specifying if the existing file(s)
should be overwritten. The default value is |
verbose |
A logical value specifying if output should be printed to the screen. |
Ian G. Taylor
SS_read()
creates the list that is used by this function.
Other read/write functions:
SS_read()
,
SS_readctl()
,
SS_readdat()
,
SS_readforecast()
,
SS_readstarter()
,
SS_writectl()
,
SS_writedat()
,
SS_writeforecast()
,
SS_writestarter()
## Not run:
# read inputlist to modify the data file
inputlist <- SS_read(
dir = system.file("extdata", "simple_small", 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")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.