From 3df3f30b664eb73ec001c80b194ba898c79c29a8 Mon Sep 17 00:00:00 2001 From: MOshima-PIFSC Date: Fri, 5 Jan 2024 11:48:50 -1000 Subject: [PATCH] fix file paths --- vignettes/articles/Jitter.Rmd | 6 +++--- vignettes/articles/Retrospective-Analysis.Rmd | 4 ++-- vignettes/articles/likelihood.Rmd | 10 ++-------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/vignettes/articles/Jitter.Rmd b/vignettes/articles/Jitter.Rmd index c58f8e6..f4308c2 100644 --- a/vignettes/articles/Jitter.Rmd +++ b/vignettes/articles/Jitter.Rmd @@ -51,8 +51,8 @@ r4ss::run(dir = dir_jitter, exe = "ss3", verbose = FALSE) ## Jitter For this example, we will run 50 jitters. The `jitter()` function automates the entire process so you only need to give it a few arguments and it will run and produce the total likelihoods for each run. -```{r} -Njitter <- 50 +```{r run-jitter} +Njitter <- 5 jit.likes <- r4ss::jitter(dir = dir_jitter, Njitter = Njitter, init_values_src = 1, @@ -92,7 +92,7 @@ converged_ssb <- jit_summary$SpawnBio %>% pivot_longer(col = c(1:(Njitter+1)), names_to = "jitter", values_to = "SSB") %>% pivot_wider(names_from = Yr, values_from = SSB) %>% mutate(rownumber = seq(1, nrow(.))) %>% - column_to_rownames("jitter") %>% + tibble::column_to_rownames("jitter") %>% filter_at(vars(1:(ncol(.)-1)), all_vars((.) < 2 & (.) > 0.5)) %>% #keep only select(rownumber) %>% pull(rownumber) diff --git a/vignettes/articles/Retrospective-Analysis.Rmd b/vignettes/articles/Retrospective-Analysis.Rmd index 23cb349..a8c4259 100644 --- a/vignettes/articles/Retrospective-Analysis.Rmd +++ b/vignettes/articles/Retrospective-Analysis.Rmd @@ -42,14 +42,14 @@ file.copy(from ="../../inst/extdata/ss", to = dir_retro) You will need to make sure you have the [SS executable](https://github.com/nmfs-stock-synthesis/stock-synthesis) file either in your path or in the directory you are running the retrospective from (in this case `dir_retro`). An easy way to get the latest release of stock synthesis is to use the `r4ss` function `get_ss3_exe()`. ```{r} -r4ss::get_ss3_exe(dir = dir_jitter, version = "v3.30.21") +r4ss::get_ss3_exe(dir = dir_retro, version = "v3.30.21") ``` ## Retrospective Analysis Once you have the 4 input files and SS executable, you can run retrospective analysis as shown below. We are running it for 5 1-year peels, so with each run, the last year of data is removed and the model is re-run for a total of 5 times. The number of year peels can be adjusted with the `years` argument. If the SS executable file you are using is named something other than "ss" (e.g. ss_opt_win.exe), you will need to specify this with the argument `exe = "ss_opt_win"`. ```{r message=FALSE} -r4ss::retro(dir = dir_retro, exe = "ss3", years = 0:-5, verbose = FALSE) +r4ss::retro(dir = dir_retro, exe = "ss3.exe", years = 0:-5, verbose = FALSE) ``` ## Visualizing Output diff --git a/vignettes/articles/likelihood.Rmd b/vignettes/articles/likelihood.Rmd index 5135007..6c00a60 100644 --- a/vignettes/articles/likelihood.Rmd +++ b/vignettes/articles/likelihood.Rmd @@ -33,16 +33,10 @@ list.files(files_path) file.copy(from = list.files(files_path, full.names = TRUE), to = dir_tmp) ``` -```{r eval=FALSE, echo=FALSE, results = FALSE} -file.copy(from ="../../inst/extdata/ss", to = dir_tmp) -file.copy(from ="../../inst/extdata/ss", to = dir_profile) -``` - - You will need to make sure you have the [SS executable](https://github.com/nmfs-stock-synthesis/stock-synthesis) file either in your path or in the directory you are running the profile from (in this case `dir_profile`). An easy way to get the latest release of stock synthesis is to use the `r4ss` function `get_ss3_exe()`. ```{r} -r4ss::get_ss3_exe(dir = dir_jitter, version = "v3.30.21") +r4ss::get_ss3_exe(dir = dir_tmp, version = "v3.30.21") ``` ## R0 Profile @@ -83,7 +77,7 @@ profile(dir = dir_profile, string = "SR_LN", profilevec = r0_vec, exe = "ss3", - verbose = FALSE) + verbose = TRUE) ``` ## Visualizing Output