# 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("example_output"),
dest_file = file.path("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("example_plots"),
dest_file = file.path("example_plots", "landings_fig_png.png"),
url = "https://raw.githubusercontent.com/nmfs-ost/workflows-workshop/main/example_output/Report.sso"
)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+ 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
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")- Explore {asar} and {stockplotr} websites
Browse the {asar} and {stockplotr} websites- especially the cheatsheets and articles.
Coding environment = the cloud (Jupyterhub)
Currently, this option is only available for NSAW workshop participants.
While we strongly encourage everyone to set up their coding environment on their local machines, we recognize that some may prefer to use a temporary, cloud-based environment for this workshop. You must export any files you wish to keep on the same day of the workshop or else they will be erased.
You can access a JupyterHub workshop server for this purpose. Before the workshop begins, please familiarize yourself with the setup instructions on the NSAW workshop page and contact us for the password.
Then, follow steps 3, 4, 5, and 7 in the section above.