Skip to contents

The R package sbt was developed for doing stock assessments of southern bluefin tuna (SBT) for the Commission for the Conservation of Southern Bluefin Tuna (CCSBT). The operating model (OM) is an age structured model coded using the Template Model Builder (TMB) software. Frequentist inference can be done using the R package nlminb and Bayesian inference can be done using the R package tmbstan.

Cloning the repository (optional)

The sbt package is available in a private GitHub repository. The repository can be cloned to your computer from the command line or using a user interface. From the command line using Linux, the repository can be cloned using:

git clone https://github.com/quantifish/sbt

Because the sbt repository is private, you will be prompted to enter your username and personal access token (PAT).

Installation

There are several options for installing the sbt R package.

Option 1

The sbt package can be installed from within R without needing to clone the repository using:

devtools::install_github(repo = "quantifish/sbt", dependencies = TRUE, 
                         auth_token = "your_PAT")

Option 2

The sbt package can also be installed from within R by cloning the repository and then using:

devtools::install("sbt")

Option 3

The sbt package can be installed from the command line by cloning the repository and then (from Linux) using:

R CMD INSTALL sbt

Option 4

If you have the sbt package downloaded on your local machine as a zip or tar.gz file, you can install it using the install.packages() function passing in the path where the zip file is saved, setting repos = NULL and type = source. For example:

install.packages("sbt_1.0.0_R_x86_64-pc-linux-gnu.tar.gz", repos = NULL, 
                 type = "source")

Help

Help for all sbt functions and data sets can be found on the R help pages associated with each function and data set. Help for a specific function can be viewed using ?function_name, for example:

?get_weight_at_age
?plot_cpue

Alternatively, to see a list of all available functions and data sets use:

help(package = "sbt")

Website

All of the vignettes and the help pages for each function are bundled together and published on the package website http://www.quantifish.co.nz/sbt/. The Getting started and Articles tabs on the website are the best place to see what sbt can do.

Developers

Developers will want to do things slightly differently. See the Model development vignette.