Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate 3.24 functions #718

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/SS_changepars.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ SS_changepars <-
if (verbose) {
message(
"Wrote new file to ", newctlfile, " with the following changes:\n",
paste0(capture.output(results), collapse = "\n")
paste0(utils::capture.output(results), collapse = "\n")
iantaylor-NOAA marked this conversation as resolved.
Show resolved Hide resolved
)
}
return(invisible(results))
Expand Down
2 changes: 1 addition & 1 deletion R/SS_fitbiasramp.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ SS_fitbiasramp <-
warning("Problem with convergence, here is output from 'optim':\n")
print(newbias)
}
message("Estimated values: \n", paste0(capture.output(df), collpase = "\n"))
message("Estimated values: \n", paste0(utils::capture.output(df), collpase = "\n"))
}

if (plot) {
Expand Down
13 changes: 10 additions & 3 deletions R/SS_readctl_3.24.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#' read control file from SS version 3.24
#' Deprecated: read control file from SS version 3.24
#'
#' Read Stock Synthesis (version 3.24) control file into list object in R.
#' This function comes with its wrapper function SS_readctl
#' that calls SS_readctl_3.24 (this function) or SS_readctl_3.30
#' (to be available in future).
#'
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @template file
#' @template verbose
#' @template readctl_vars
Expand Down Expand Up @@ -46,6 +47,12 @@ SS_readctl_3.24 <- function(file,
N_CPUE_obs = NULL,
##################################
ptype = lifecycle::deprecated()) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_readctl_3.24()",
details = "Please update model to version 3.30."
)
# deprecated variable warnings -----
# soft deprecated for now, but fully deprecate in the future.
if (lifecycle::is_present(ptype)) {
Expand Down
12 changes: 10 additions & 2 deletions R/SS_readdat_2.00.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#' read data file from SS version 2.00
#' Deprecated: read data file from SS version 2.00
#'
#' Read Stock Synthesis (version 2.00) data file into list object in R.
#' This function was formerly called SS_readdat. That name is now used
#' for a wrapper function that calls either SS_readdat_2.00 SS_readdat_3.00
#' SS_readdat_3.24 or SS_readdat_3.30 (and potentially additional functions in the future).
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @template file
#' @template verbose
Expand All @@ -21,6 +23,12 @@
#' [SS_writeforecast()], [SS_writedat()]
SS_readdat_2.00 <- function(file, verbose = TRUE,
echoall = lifecycle::deprecated(), section = NULL) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_readdat_2.00()",
details = "Please update model to version 3.30."
)
# function to read Stock Synthesis data files
if (lifecycle::is_present(echoall)) {
lifecycle::deprecate_warn(
Expand Down Expand Up @@ -146,7 +154,7 @@ SS_readdat_2.00 <- function(file, verbose = TRUE,
areas <- datlist[["areas"]]
if (verbose) {
message("areas:", areas)
message("fleet info:\n", paste0(capture.output(
message("fleet info:\n", paste0(utils::capture.output(
data.frame(
fleet = 1:Ntypes,
name = fleetnames,
Expand Down
13 changes: 11 additions & 2 deletions R/SS_readdat_3.00.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#' read data file from SS version 3.00
#' Deprecate: read data file from SS version 3.00
#'
#' Read Stock Synthesis (version 3.00) data file into list object in R.
#' This function was formerly called SS_readdat. That name is now used
#' for a wrapper function that calls either SS_readdat_3.24 or SS_readdat_3.30
#' (and potentially additional functions in the future).
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#'
#' @template file
#' @template verbose
Expand All @@ -21,6 +24,12 @@
#' [SS_writeforecast()], [SS_writedat()]
SS_readdat_3.00 <- function(file, verbose = TRUE,
echoall = lifecycle::deprecated(), section = NULL) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_readdat_3.00()",
details = "Please update model to version 3.30."
)
# function to read Stock Synthesis data files
if (lifecycle::is_present(echoall)) {
lifecycle::deprecate_warn(
Expand Down Expand Up @@ -140,7 +149,7 @@ SS_readdat_3.00 <- function(file, verbose = TRUE,
i <- i + Ntypes
if (verbose) {
message("areas:", areas)
message("fleet info:\n", paste0(capture.output(
message("fleet info:\n", paste0(utils::capture.output(
data.frame(
fleet = 1:Ntypes,
name = fleetnames,
Expand Down
18 changes: 11 additions & 7 deletions R/SS_readdat_3.24.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#' read data file from SS version 3.24
#' Deprecated: read data file from SS version 3.24
#'
#' Read Stock Synthesis (version 3.24) data file into list object in R.
#' This function was formerly called SS_readdat. That name is now used
#' for a wrapper function that calls either SS_readdat_3.24 or SS_readdat_3.30
#' (and potentially additional functions in the future).
#'
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @template file
#' @template verbose
Expand All @@ -21,7 +20,12 @@
#' [SS_writestarter()],
#' [SS_writeforecast()], [SS_writedat()]
SS_readdat_3.24 <- function(file, verbose = TRUE, echoall = lifecycle::deprecated(), section = NULL) {

# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_readdat_3.24()",
details = "Please update model to version 3.30."
)
# deprecated arguments
if (lifecycle::is_present(echoall)) {
lifecycle::deprecate_warn(
Expand Down Expand Up @@ -138,7 +142,7 @@ SS_readdat_3.24 <- function(file, verbose = TRUE, echoall = lifecycle::deprecate
i <- i + Ntypes
if (verbose) {
message("areas:", areas)
message("fleet info:\n", paste0(capture.output(
message("fleet info:\n", paste0(utils::capture.output(
data.frame(
fleet = 1:Ntypes,
name = fleetnames,
Expand Down
10 changes: 9 additions & 1 deletion R/SS_readpar_3.24.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#' read ss.par file from SS version 3.24
#' Deprecated: read ss.par file from SS version 3.24
#'
#' Read Stock Synthesis (version 3.24) parameter file into list object in R.
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @param parfile Filename either with full path or relative to working directory.
#' @param datsource list or character. If list, should be a list produced
Expand All @@ -20,6 +22,12 @@
#' [SS_writestarter()],
#' [SS_writeforecast()], [SS_writedat()]
SS_readpar_3.24 <- function(parfile, datsource, ctlsource, verbose = TRUE) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_readpar_3.24()",
details = "Please update model to version 3.30."
)
if (is.character(datsource)) {
datlist <- SS_readdat(file = datsource, version = "3.24", verbose = FALSE)
} else if (is.list(datsource)) {
Expand Down
4 changes: 2 additions & 2 deletions R/SS_varadjust.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ SS_varadjust <- function(dir = "C:/myfiles/mymodels/myrun/",
if (verbose) {
message(
"Existing table of variance adjustments:\n",
paste0(capture.output(ctl), collapse = "\n")
paste0(utils::capture.output(ctl), collapse = "\n")
)
}

Expand Down Expand Up @@ -176,7 +176,7 @@ SS_varadjust <- function(dir = "C:/myfiles/mymodels/myrun/",
if (verbose) {
message(
"New table of variance adjustments:\n",
paste0(capture.output(ctl), collapse = "\n")
paste0(utils::capture.output(ctl), collapse = "\n")
)
}

Expand Down
12 changes: 11 additions & 1 deletion R/SS_writectl_3.24.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#' write control file
#' Deprecated: write 3.24 control file
#'
#' write Stock Synthesis control file from list object in R which was probably
#' created using [SS_readctl()]
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @param ctllist List object created by [SS_readctl()].
#' @param outfile Filename for where to write new data file.
#' @template overwrite
Expand All @@ -14,6 +18,12 @@
# ' \code{\link{SS_writedat}}
SS_writectl_3.24 <- function(ctllist, outfile, overwrite = FALSE,
verbose = FALSE) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_writectl_3.24()",
details = "Please update model to version 3.30."
)
# Add msgs for deprecated args ----
# these should be removed after 1 release version.

Expand Down
12 changes: 10 additions & 2 deletions R/SS_writedat_3.24.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#' write data file for SS version 3.24
#' Deprecated: write data file for SS version 3.24
#'
#' Write Stock Synthesis data file from list object in R which was probably
#' created using [SS_readdat()] (which would have called on
#' [SS_readdat_3.24()]).
#'
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @param datlist List object created by [SS_readdat()].
#' @param outfile Filename for where to write new data file.
#' @template overwrite
Expand All @@ -24,6 +26,12 @@ SS_writedat_3.24 <- function(datlist,
overwrite = FALSE,
faster = lifecycle::deprecated(),
verbose = TRUE) {
# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_writedat_3.24()",
details = "Please update model to version 3.30."
)
# function to write Stock Synthesis data files
if (verbose) {
message("running SS_writedat_3.24")
Expand Down
11 changes: 9 additions & 2 deletions R/SS_writepar_3.24.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#' write ss.par file from SS version 3.24
#' Deprecated: write ss.par file from SS version 3.24
#'
#' Write Stock Synthesis (version 3.24) parameter file from list object in R to file.
#'
#' Support for 3.24 models within the r4ss `SS_read*` and `SS_write*()`
#' functions is ending, so please update models to 3.30.
#'
#' @param parlist List object created by [SS_readpar_3.24()].
#' @param outfile Filename for where to write new parameter file.
Expand All @@ -16,7 +18,12 @@
#' [SS_writestarter()],
#' [SS_writeforecast()], [SS_writedat()]
SS_writepar_3.24 <- function(parlist, outfile, overwrite = TRUE, verbose = FALSE) {

# deprecate. Remove code upon next release.
lifecycle::deprecate_warn(
when = "1.45.3",
what = "SS_writepar_3.24()",
details = "Please update model to version 3.30."
)
# function to write Stock Synthesis parameter files
if (verbose) message("running SS_writepar_3.24")

Expand Down
6 changes: 3 additions & 3 deletions R/SSmakeMmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ SSmakeMmatrix <- function(mat, startyr, outfile = NULL,

message(
"Mortality params to paste into the first block of parameter lines:\n",
paste0(capture.output(Mparams), collapse = "\n")
paste0(utils::capture.output(Mparams), collapse = "\n")
)
printdf(Mparams)

Expand All @@ -134,7 +134,7 @@ SSmakeMmatrix <- function(mat, startyr, outfile = NULL,
message(
"\n# stuff to paste below the line labeled 'CohortGrowDev'\n",
"1 #_custom mortality/growth environmental setup\n",
paste0(capture.output(Mlinks), collapse = "\n")
paste0(utils::capture.output(Mlinks), collapse = "\n")
)

# create a data frame of environmental variables
Expand All @@ -157,7 +157,7 @@ SSmakeMmatrix <- function(mat, startyr, outfile = NULL,
"Environmental variables to paste into the bottom of the data file:\n",
maxage + 1, " # N environmental variables\n",
nrow(Menv), " # N environmental observations\n",
paste0(capture.output(Menv), collapse = "\n")
paste0(utils::capture.output(Menv), collapse = "\n")
)

# restore things to how they were
Expand Down
2 changes: 1 addition & 1 deletion R/SSplotRecdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SSplotRecdist <-
colnames(recmat) <- seasnames
message(
"recruitment distribution by area and season:\n",
paste0(capture.output(recmat), collapse = "\n")
paste0(utils::capture.output(recmat), collapse = "\n")
)
if (plot) recdistfun()
if (print) {
Expand Down