inst/contribute/copy_ex9.R

# after running the example scripts, copy output to correct locations:
#   plot files used by vignettes (vignettes/exY_plots/)
#   data files used by vignettes (data/)
#   test results (inst/extdata/exY_test_results.rds)

# This file uses the 'here' package to work across computers, as long as you 
#   *open from the top-level wham folder* (where you git cloned wham into).
# If you do not have 'here' installed:
# install.packages("here")
library(here)
pkg.dir <- here()
devtools::load_all(path = pkg.dir)

# assumes you have a .gitignore'd folder 'sandbox' in the wham folder
# assumes you ran the ex today. if not, need to change
main.dir <- file.path(pkg.dir, "sandbox", paste0("runall-",format(Sys.Date(), "%Y%m%d")))
write.dir <- file.path(main.dir,"ex9")

# copy to vignette plots folder
to.dir <- file.path(pkg.dir, "vignettes", "ex9_plots")
file.copy(from=file.path(write.dir,"retro_pred_R.png"), to=file.path(to.dir,"retro_pred_R.png"), overwrite = TRUE)
timjmiller/wham documentation built on April 28, 2024, 5:39 a.m.