Package 'VRAPS'

Title: VRAP 2nd edition with C++ for RER and Viability Computations
Description: This is a rewrite of the R version of the VRAP program. The original VRAP R package was a one-to-one translation from the original Visual Basic code. VRAPCpp is the same equations, but completely re-written by Martin Liermann to be more efficient. VRAPCpp does not have all the functionality of VRAP. Many of the rav options in VRAP were not used and are removed. There is a shiny that emulates the VRAP 1.0 shiny app.
Authors: Martin Liermann [aut], Eli Holmes [aut, cre], Howard Coleman [ctb]
Maintainer: Elizabeth Holmes - NOAA Federal <[email protected]>
License: GPL (>= 2)
Version: 2.0
Built: 2025-01-31 02:37:09 UTC
Source: https://github.com/noaa-nwfsc/VRAPCpp

Help Index


VRAP with C++ for RER and Viability Computations

Description

This is a rewrite of the R version of the VRAP program. The original VRAP R package was a one-to-one translation from the original Visual Basic code. VRAPCpp is the same equations, but completely re-written by Martin Liermann to be more efficient. VRAPCpp does not have all the functionality of VRAP. Many of the rav options in VRAP were not used and are removed.

Details

Call 'vignette(package = "VRAPS")' to see all the package documentation and examples.

Author(s)

Martin Liermann and Elizabeth Holmes

Maintainer: Elizabeth Holmes <[email protected]>


CompStats

Description

Returns the statistics (calculated values) needed to produce the summary output files

Usage

CompStats(inputs, SimResults)

Arguments

inputs

Inputs from .rav file

SimResults

A list from RunSims2R or RunSims2C with totEsc and totAEQMort for each ER/Pop value, each sim rep, and each year.

Details

This function similar but not identical to the original VB function in VRAP

Value

SummaryStats and staticvars list


GetInput

Description

Read in an input file and assign all the variables

Usage

GetInput(InFile)

Arguments

InFile

the name of the input file

Value

Returns the list of all inputs


Backwards Compatibility for inputs List

Description

Ensure that inputs list can be used in VRAP 1.0 functions

Usage

InputsBackwardCompat(inputs)

Arguments

inputs

A list of the necessary input values (can be taken from .rav file).

Details

The VRAP 2.0 inputs list is very similar to VRAP 1.0 but has a few differences related to how ER and Pop steps are named. This creates entries in inputs that has the same names used in VRAP 1.0 so that the inputs list in VRAP 2.0 can be passed to VRAP 1.0 functions.

Value

Returns the list of all inputs with added values so that list is compatible with VRAP 1.0 functions


Main sensu VRAP 1.0 but for VRAP 2.0

Description

Runs VRAP sensu 1.0 with the VRAP 2.0 totEsc engine. Does not use parallel in R code, but has C++ version.

Usage

Main.VRAP1(InFile = NULL, OutFileBase = NULL, NRuns = -1, NYears = -1,
  Title = -1, TargetStart = -1, TargetEnd = -1, TargetStep = -1,
  ERecovery = -1, QET = -1, ECrit = -1, NewRavFileName = "tmprav.rav",
  forceNewRav = NULL, silent = FALSE, version = "R",
  save.output.as.files = TRUE)

Arguments

InFile

The name of the .rav file. Only .rav since this is to duplicate VRAP 1.0

OutFileBase

The basename for the .sum, .byr, and .esc output files

NRuns

Number of runs to use in the simulations if the user wants to use something different than what is in the .rav file

NYears

Number of years to project forward in the simulations if the user wants to use something different than what is in the .rav file

Title

Title to use for the report if the user wants to use something different than what is in the .rav file

TargetStart

Target ER to start simulations at if the user wants to use something different than what is in the .rav file

TargetEnd

Target ER to end simulations at if the user wants to use something different than what is in the .rav file

TargetStep

Target ER step sizes if the user wants to use something different than what is in the .rav file

ERecovery

Recovery target if the user wants to use something different than what is in the .rav file

QET

if the user wants to use something different than what is in the .rav file

ECrit

if the user wants to use something different than what is in the .rav file

NewRavFileName

A new .rav file is saved in case the user has changed any values from what is in the .rav file.

forceNewRav

Force use of new rav file. Needed for shiny app.

silent

Whether to show progress bar.

version

"R" or "C". C is much faster.

save.output.as.files

If TRUE (default), then .sum, .byr, .esc and .rav files are saved using OutFileBase. If FALSE, no files are saved and only the list is output.

Value

list with output list from RunSims() and output time


Read in rap File

Description

Read in a VRAP 2.0 .rap input file and assign all the variables needed for VRAP 2.0

Usage

ReadRapFile(InFile)

Arguments

InFile

the name of the .rap file

Details

A .rap file is the input file for VRAP 2.0. VRAP 2.0 uses most but not all the VRAP 1.0 specs and requires that some .rav values have certain values. If illegal values are encountered, an error is returned.

Value

Returns the list of all inputs

Examples

## Not run: 
fpath <- system.file("VRAP", "demofiles/Demo-ER.rap", package="VRAPS")
file.show(fpath)

## End(Not run)

Read in rav File

Description

Read in a VRAP 1.0 .rav file and assign all the variables need for VRAP 2.0

Usage

ReadRavFile(InFile)

Arguments

InFile

the name of the .rav file

Details

A .rav file is the input file for VRAP 1.0. VRAP 2.0 uses most but not all the VRAP 1.0 specs and requires that some .rav values have certain values. If illegal values are encountered, an error is returned.

Value

Returns the list of all inputs

Examples

## Not run: 
fpath <- system.file("VRAP", "demofiles/Demo-ER.rav", package="VRAPS")
file.show(fpath)

## End(Not run)

Run simulations sensu VRAP 1.0

Description

RunSims.VRAP1 takes the input list, runs the VRAP simulations, and returns the summary statistics used by VRAP 1.0

Usage

RunSims.VRAP1(inputs, version = "R")

Arguments

inputs

Inputs from .rav file

version

R or C++

Details

This function is to produce VRAP 1.0 output stats using VRAP 1.0 functions.

Value

list with inputs, SummaryStats, staticvars, comp.time.


Run VRAP 2.0 Simulations in C++

Description

Run the VRAP2 simulations in C++ over a specified range of escapement rates (ERs).

Usage

RunSims2C(inputs, silent = TRUE)

Arguments

inputs

A list of the necessary input values (can be taken from .rav file).

silent

Whether print progress as the current ER value.

Details

Calls the C++ function 'simFish' to run the VRAP simulations and returns a 3D array of the total escapement at each exploitation rate (ER) for NRuns over NYears.

Value

A list with the input and the 3D array of total escapment values.


Run VRAP 2.0 Simulations in native R

Description

Run the VRAP2 simulations in native R over a specified range of escapement rates (ERs).

Usage

RunSims2R(inputs, silent = TRUE)

Arguments

inputs

A list of the necessary input values (can be taken from .rav file).

silent

Whether print progress as the current ER value.

Details

Runs the simulations and returns an 3D array of the total escapement at each exploitation rate (ER) for NRuns over NYears.

Value

A list with the inputs and the 3D array of total escapment values.


Write Rap File from VRAP 2.0 inputs list

Description

Takes the input list and writes a .rap file.

Usage

WriteRapFile(inputs, FileName = "tmp.rav")

Arguments

inputs

A list of the necessary input values for RunSims2R and RunSims2C.

ravFileName

Name of the .rav file that data will be written to.

Details

Takes the inputs list and write a .rap file that can be input into VRAP 2.0 function ReadRapFile or GetInput. Note that in VRAP 2.0, the beginning and ending ER (or Pop) values are given in absolute values not as a fraction of base level as in VRAP 1.0.

Value

Nothing. The data is written to FileName.


Write Rav File from VRAP 2.0 inputs list

Description

Takes the input list and write a .rav file.

Usage

WriteRavFile(inputs, FileName = "tmp.rav")

Arguments

inputs

A list of the necessary input values for RunSims2R and RunSims2C.

FileName

Name of the .rav file that data will be written to.

Details

Takes the inputs list and write a .rav file that can be input into the VRAP 1.0 function Main.

Value

Nothing. The data is written to ravFileName.