pak::pak("quarto")
quarto::quarto_version()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
- Ensure that you can run R code with a platform like RStudio, VS Code, Positron, etc.
- Ensure you have downloaded Quarto, version 1.6+, the
quartoR package, and can create Quarto documents.
Optional: Create a new Github repo for the workshop. Do not complete the last step (“12.7 Clean up”). First, install Git if you don’t have it.
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
# 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"
)- 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")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.
- Explore {asar} and {stockplotr} websites
Browse the {asar} and {stockplotr} websites- especially the cheatsheets and articles.