Learn R Programming

r4ss (version 1.24.0)

SS_changepars: Change parameters, bounds, or phases in the control file.

Description

Loops over a subset of control file to change parameter lines. Current initial value, lower and upper bounds, and phase can be modified, but function could be expanded to control other columns. Depends on SS_parlines. Used by SS_profile and the ss3sim package.

Usage

SS_changepars(dir = NULL, ctlfile = "control.ss_new",
  newctlfile = "control_modified.ss", linenums = NULL, strings = NULL,
  newvals = NULL, repeat.vals = FALSE, newlos = NULL, newhis = NULL,
  estimate = FALSE, verbose = TRUE, newphs = NULL)

Arguments

dir

Directory with control file to change.

ctlfile

Control file name. Default="control.ss_new".

newctlfile

Name of new control file to be written. Default="control_modified.ss".

linenums

Line numbers of control file to be modified. Either this or the strings argument are needed. Default=NULL.

strings

Strings (with optional partial matching) indicating which parameters to be modified. This is an alternative to linenums. strings correspond to the commented parameter names included in control.ss_new, or whatever is written as comment at the end of the 14 number parameter lines. Default=NULL.

newvals

Vector of new parameter values. Default=NULL. The vector can contain NA values, which will assign the original value to the given parameter but change the remainder parameters, where the vector of values needs to be in the same order as either linenums or strings.

repeat.vals

If multiple parameter lines match criteria, repeat the newvals input for each line.

newlos

Vector of new lo bounds. Default=NULL. The vector can contain NA values, which will assign the original value to the given parameter but change the remainder parameters, where the vector of values needs to be in the same order as either linenums or strings.

newhis

Vector of new hi bounds. Must be the same length as newhis Default=NULL. The vector can contain NA values, which will assign the original value to the given parameter but change the remainder parameters, where the vector of values needs to be in the same order as either linenums or strings.

estimate

Vector of TRUE/FALSE for which changed parameters are to be estimated. Default=FALSE. Can also be NULL.

verbose

More detailed output to command line. Default=TRUE.

newphs

Vector of new phases. Can be a single value, which will be repeated for each parameter, the same length as newvals, where each value corresponds to a single parameter, or NULL, where the phases will not be changed. If one wants to strictly turn parameters on or off and not change the phase in which they are estimated use estimate = TRUE or estimate = FALSE, respectively. The vector can contain NA values, which will assign the original value to the given parameter but change the remainder parameters, where the vector of values needs to be in the same order as either linenums or strings.

See Also

SS_parlines, SS_profile

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
SS_changepars(dir='Y:/ss/SSv3.03a/Simple/',ctlfile='Control.SS_New',
              strings=c('SR_steep','SR_sigmaR'),newvals=c(.35,.6))
# [1] wrote new file to Control_Modified.SS
#    oldvals newvals oldphase newphase     comment
# 1 0.609048    0.35        4       -4  # SR_steep
# 2 0.600000    0.60       -4       -4 # SR_sigmaR
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab