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.

Coding environment = your local machine

  1. Ensure that you can run R code with a platform like RStudio, VS Code, Positron, etc.
  2. Ensure you have downloaded Quarto, version 1.6+ and can create Quarto documents.
quarto::quarto_version()
  1. Create a new Github repo for the workshop. Do not complete the last step (“12.7 Clean up”).

  2. Clone your repo and set up an RStudio Project.

  3. Run the following code to get two essential files from the workflows-workshop github repo:

  4. Input data file “Report.sso” will save to a “example_output” folder in your home directory

  5. Example plot file “landings_fig_png.png” will save to a “example_plots” folder in your home directory

# Function to obtain 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("example_output"),
  dest_file = file.path("example_output", "Report.sso"),
  url = "https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/main/example_output/Report.sso"
  )

# Obtain example figure file
get_workshop_files(
  dest_folder = file.path("example_plots"),
  dest_file = file.path("example_plots", "landings_fig_png.png"),
  url = "https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/main/example_plots/landings_fig_png.png"
  )
  1. Install important R packages

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")
Tip

To test your TinyTeX setup, you can save the following code in a Quarto file (“test.qmd”) and hit Render. If it renders, that’s a good sign! If you get an error, you may have an issue with your TinyTeX installation:

---
title: "TinyTeX Test"
format: pdf
---

Sample text to test if your Quarto file rendered into a PDF.
  1. Explore {asar} and {stockplotr} websites

Browse the {asar} and {stockplotr} websites- especially the cheatsheets and articles.