# Function to obtain two files used during workshop
get_workshop_files <- function(dest_folder,
dest_file,
url){
if (!file.exists(dest_folder)) {
dir.create(dest_folder)
}
if (!file.exists(dest_file)) {
cli::cli_alert_info("📥 Downloading {dest_file}...")
download.file(url, dest_file, mode = "wb")
message("✅ Download complete.")
} else {
cli::cli_alert_info("✅ File already exists: {dest_file}")
}
}
# Obtain example output file
get_workshop_files(
dest_folder = file.path(here::here("example_output")),
dest_file = file.path(here::here("example_output", "Report.sso")),
url = "https://github.com/nmfs-ost/workflows-workshop/blob/main/example_output/Report.sso"
)
# Obtain example figure file
get_workshop_files(
dest_folder = file.path(here::here("example_plots")),
dest_file = file.path(here::here("example_plots", "landings_fig_png.png")),
url = "https://github.com/nmfs-ost/workflows-workshop/blob/main/example_plots/landings_fig_png.png"
)Pre-workshop checklist
Here are the main steps needed to set up your environment so that you’re ready to use asar and stockplotr to create a stock assessment report.
If you have any questions, please contact the workshop organizers.
- Ensure that you can run R code with a platform like RStudio, VS Code, Positron, etc.
- Ensure you have downloaded Quarto, version 1.6+ and can create Quarto documents.
- Create a new Github repo for the workshop.
- Clone your repo and set up an RStudio Project.
- Run the following code to get two essential files from the workflows-workshop github repo:
- input data file “Report.sso” will save to a “example_output” folder in your home directory
- example plot file “landings_fig_png.png” will save to a “example_plots” folder in your home directory
- Install important R packages {#sec-install_pkgs}
The following packages are already installed in the asar workspace on JupyterHub, so if you are using that space, you can skip this section.
We recommend using the pak R package to install R packages where possible, since it avoids re-downloading files if they’re already present.
install.packages("pak")asar
pak::pak("nmfs-ost/asar")Please see the asar README for more installation options.
stockplotr
pak::pak("nmfs-ost/stockplotr")Please see the stockplotr README for more installation options.
tinytex
We recommend installing the full tinytex bundle to ensure that all LaTeX packages will be present when you need them. This will take ~30 minutes to complete.
pak::pkg_install("rstudio/tinytex")
tinytex::install_tinytex(bundle = "TinyTeX-2")