# Create a temporary folder for the output and set the working directory:
wd.old <- getwd()
temp_path <- file.path(tempdir(), "change_year-example")
dir.create(temp_path, showWarnings = FALSE)
setwd(temp_path)
# Find the SS3 "Simple" model in the package data:
d <- system.file("extdata", package = "ss3sim")
simple <- paste0(d, "/Simple")
dir.create("Simple")
file.copy(simple, ".", recursive = TRUE)
setwd("Simple")
# Run SS3 to create control.ss_new and Report.sso:
system("SS3_24o_safe starter.ss -noest")
change_year(year_begin = 1, year_end = 100, burnin = 25,
ctl_file_in = "control.ss_new", ctl_file_out = "change_year.ctl",
dat_file_in = "simple.dat", dat_file_out = "change_year.dat",
par_file_in = "ss3.par", par_file_out = "change_year.par",
str_file_in = "starter.ss", str_file_out = "change_year_starter.ss",
for_file_in = "forecast.ss", for_file_out = "change_year_forecast.ss")
# Clean up:
setwd("../")
unlink("Simple")
setwd(wd.old)
Run the code above in your browser using DataLab