change_pars: change parameter values in a table within the control file...

View source: R/change_pars.R

change_parsR Documentation

change parameter values in a table within the control file list object in R

Description

applies no LO, HI, INIT, or PHASE value to parameter line in a table of parameters within the list created by get_inputs_ling() or r4ss::SS_readctl(). This is similar to r4ss::SS_changepars() but that function modifies the control file itself not the corresponding R object.

Usage

change_pars(
  pars,
  string,
  LO = NULL,
  HI = NULL,
  INIT = NULL,
  PHASE = NULL,
  PRIOR = NULL,
  PR_SD = NULL,
  PR_type = NULL,
  Block = NULL,
  Block_Fxn = NULL,
  allrows = TRUE,
  verbose = TRUE
)

Arguments

pars

A parameter table from the control file list object. For the initial 2021 lingcod models, this can be any of MG_parms, SR_parms, Q_parms, Q_parms_tv, size_selex_parms, or size_selex_parms_tv.

string

String which matches part of the parameter labels for the parameters to be modified. When multiple parameters match the string they will all be changed.

LO

New lower bound value

HI

New upper bound value

INIT

New initial value

PHASE

New phase value

Block

New block value (which block pattern to use)

Block_Fxn

New phase function value (e.g. 2 = replace)

allrows

Logical: TRUE = return the full parameter table, FALSE = return only the parameter lines that match string.

verbose

A logical value specifying if output should be printed to the console or not. The default is FALSE, which will suppress messages.

Value

Either the full table of parameters that can be inserted into directly into the inputs$ctl list or (if allrows = FALSE), a subset of that table with just the lines matching string.

Author(s)

Ian G. Taylor

Examples

## Not run: 
  # read inputs
  inputs <- get_inputs_ling(id = get_id_ling(newdir))
  # copy control file info to new object
  newctl <- inputs$ctl
  # update parameter lines for first double-normal parameter
  newctl$size_selex_parms <-
    change_pars(pars = newctl$size_selex_parms,
                string = "SizeSel_P_1",
                LO = 20,
                HI = 100,
                INIT = 60
                PHASE = 3)

  # check which lines match a string with no changes
  change_pars(pars = newctl$SR_parm, string = "R0", allrows = FALSE)

## End(Not run)

iantaylor-NOAA/Lingcod_2021 documentation built on Oct. 30, 2024, 6:42 p.m.