The goal of groundfishr is to create a clear workflow for pulling and cleaning data for fishery stock assessments based upon the ADMB rockfish assessment framework It utilizes a “project oriented workflow” via RStudio (base R is ok, though you must use here::here()). You must be able to have a connection to the AFSC & AKFIN (Answers) data servers (e.g., VPN if offsite), and have usernames/passwords setup.

Installation

The groundfishr package can be installed from github with:

# install.packages("devtools")
devtools::install_github("BenWilliams-NOAA/groundfishr")

A consistent directory format is probably the most important aspect of this package. The first function creates a number of directories within your R project folder. The setup is organized by year within a folder. The setup() function creates the following folders and files:

# setup folders -----

setup(2020)
project
|__2020
    |__data
        |__models
        |    |__ageage
        |    |     AGEAGE.tpl
        |    |__allometric
        |    |     allometric.tpl
        |    |__length_sd
        |    |     lengthSD.tpl
        |    |__VBL
        |    |      VBL.tpl
        |    |__wVBL
        |    |      wVBL.tpl
        |    |      lvb.ctl
        |
        |__output
        |__raw
        |__SARA
        |__user_input

This can then be updated for each year.

# setup folders -----

setup(2021)

Which would create a duplication of the folders for the given year

project
|__2020
|   |__data
|       |__models
|       |    |__ageage
|       |    |     AGEAGE.tpl
|       |    |__allometric
|       |    |     allometric.tpl
|       |    |__length_sd
|       |    |     lengthSD.tpl
|       |    |__VBL
|       |    |      VBL.tpl
|       |    |__wVBL
|       |    |      wVBL.tpl
|       |    |      lvb.ctl
|       |
|       |__output
|       |__raw
|       |__SARA
|       |__user_input
|__2021
    |__data
        |__models
        |    |__ageage
        |    |     AGEAGE.tpl
        |    |__allometric
        |    |     allometric.tpl
        |    |__length_sd
        |    |     lengthSD.tpl
        |    |__VBL
        |    |      VBL.tpl
        |    |__wVBL
        |    |      wVBL.tpl
        |    |      lvb.ctl
        |
        |__output
        |__raw
        |__SARA
        |__user_input        

The SSC accepted model can then be added from the last assessment as the current year’s “base model”.

accepted_model(base_year = 2020, base_model = "m18.2b", year = 2021)

This creates a duplication of the folders for the given year

project
|__2020
    |__data
    |__base    # last accepted model
    |__m18.2a  # model variant a
    |__m18.2b  # model variant b
|__2021
    |__data
    |__base   # dupication of m18.2b
        |__ base_model_2020_m18.2b.txt"