Here we present an example of how a modular stock assessment software architecture may be implemented using Rcpp.

Setup

Before running this notebook, you will need to ensure you have a C++ compiler and Rcpp installed. Then, try to install the r4MAS package from Github and load it. If you have trouble, it could be because of a problem with your C++ compiler - see the Readme for a potential fix.

## Loading required package: Rcpp
remotes::install_github("nmfs-fish-tools/r4MAS")
## Downloading GitHub repo nmfs-fish-tools/r4MAS@HEAD
## Rcpp (1.0.7 -> 1.0.8) [CRAN]
## Installing 1 packages: Rcpp
## Warning: package 'Rcpp' is in use and will not be installed
##   
  
  
   checking for file 'C:\Users\bai.li\AppData\Local\Temp\RtmpKq7gWg\remotes35c016e91c59\nmfs-fish-tools-r4MAS-a3fdf46/DESCRIPTION' ...
  
   checking for file 'C:\Users\bai.li\AppData\Local\Temp\RtmpKq7gWg\remotes35c016e91c59\nmfs-fish-tools-r4MAS-a3fdf46/DESCRIPTION' ... 
  

[32mv
[39m  
[38;5;247mchecking for file 'C:\Users\bai.li\AppData\Local\Temp\RtmpKq7gWg\remotes35c016e91c59\nmfs-fish-tools-r4MAS-a3fdf46/DESCRIPTION'
[39m
[36m
[36m (609ms)
[36m
[39m
## 
  
  
  

[38;5;247m-
[39m
[38;5;247m  
[39m
[38;5;247mpreparing 'r4MAS':
[39m
[36m
[36m (2.3s)
[36m
[39m
##    checking DESCRIPTION meta-information ...
  
   checking DESCRIPTION meta-information ... 
  

[32mv
[39m  
[38;5;247mchecking DESCRIPTION meta-information
[39m
[36m
[39m
## 
[38;5;247m-
[39m
[38;5;247m  
[39m
[38;5;247mcleaning src
[39m
[36m
[39m
## 
  
  
  

[38;5;247m-
[39m
[38;5;247m  
[39m
[38;5;247mchecking for LF line-endings in source and make files and shell scripts
[39m
[36m
[36m (755ms)
[36m
[39m
## 
  
  
  
   
  
   checking for empty or unneeded directories
  

[38;5;247m-
[39m
[38;5;247m  
[39m
[38;5;247mchecking for empty or unneeded directories
[39m
[36m
[36m (1.7s)
[36m
[39m
## 
  
Removed empty directory 
  
   Removed empty directory 'r4MAS/src/mas/third_party/ATL/docs/html'
##    Removed empty directory 'r4MAS/src/mas/third_party/ATL/docs/latex'
## 
  
   Omitted 'LazyData' from DESCRIPTION
## 
  
  
  

[38;5;247m-
[39m
[38;5;247m  
[39m
[38;5;247mbuilding 'r4MAS_0.1.0.tar.gz'
[39m
[36m
[39m
## 
  
Warning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
  
   Warning in utils::tar(filepath, pkgname, compression = compression, compression_level = 9L,  :
##      storing paths of more than 100 bytes is not portable:
##      'r4MAS/src/mas/third_party/ATL/lib/third_party/hat-trie-master/include/tsl/array-hash/array_growth_policy.h'
## 
  
   
## 
## Installing package into 'C:/Users/bai.li/AppData/Local/Temp/RtmpI3qN8m/temp_libpath2bbc5c4c1486'
## (as 'lib' is unspecified)
## Warning in i.p(...): installation of package 'C:/Users/bai.li/AppData/Local/
## Temp/RtmpKq7gWg/file35c0771149e4/r4MAS_0.1.0.tar.gz' had non-zero exit status

Create model

Add model components