From 7bac9711ac072cb1949e16434997356d35866df2 Mon Sep 17 00:00:00 2001 From: ericward-noaa Date: Wed, 18 Nov 2026 07:02:35 -0800 Subject: [PATCH 1/2] Fix R CMD check warnings and notes after #477 Regenerated convert_output.Rd, which was missing start_year, and wrapped lines, also correcting file/model to files/models. Fixed @param file. to @param file in conout_bam, conout_rceattle and conout_ss3, which removes the stray Path. argument. Wrote unit, block and predicted_recruitment as .data$ or quoted names rather than adding them to the global variables list --- R/conout_bam.R | 2 +- R/conout_rceattle.R | 2 +- R/conout_ss3.R | 2 +- R/convert_output.R | 18 ++++++++++++------ R/extract_sis_data.R | 2 +- R/plot_data_availability.R | 2 +- R/plot_landings.R | 2 +- R/table_landings.R | 4 ++-- R/table_projections.R | 4 ++-- man/conout_bam.Rd | 10 +++------- man/conout_rceattle.Rd | 10 +++------- man/conout_ss3.Rd | 10 +++------- man/convert_output.Rd | 34 +++++++++++++++++++++++----------- 13 files changed, 54 insertions(+), 48 deletions(-) diff --git a/R/conout_bam.R b/R/conout_bam.R index 4f55aa7a..b9f1c5a6 100644 --- a/R/conout_bam.R +++ b/R/conout_bam.R @@ -4,7 +4,7 @@ #' #' @inheritParams convert_output #' -#' @param file. Assessment model output file path. Currently accepts SS3 +#' @param file Path. Assessment model output file path. Currently accepts SS3 #' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. #' #' @param out_new The empty standard output data frame from diff --git a/R/conout_rceattle.R b/R/conout_rceattle.R index 4baacd94..592f135f 100644 --- a/R/conout_rceattle.R +++ b/R/conout_rceattle.R @@ -4,7 +4,7 @@ #' #' @inheritParams convert_output #' -#' @param file. Assessment model output file path. Currently accepts SS3 +#' @param file Path. Assessment model output file path. Currently accepts SS3 #' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. #' #' @param out_new The empty standard output data frame from diff --git a/R/conout_ss3.R b/R/conout_ss3.R index b6b011c0..de7e4186 100644 --- a/R/conout_ss3.R +++ b/R/conout_ss3.R @@ -5,7 +5,7 @@ #' #' @inheritParams convert_output #' -#' @param file. Assessment model output file path. Currently accepts SS3 +#' @param file Path. Assessment model output file path. Currently accepts SS3 #' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. #' #' @param out_new The empty standard output data frame from diff --git a/R/convert_output.R b/R/convert_output.R index 3622f13d..0742ca5c 100644 --- a/R/convert_output.R +++ b/R/convert_output.R @@ -61,15 +61,21 @@ #' @examples #' \dontrun{ #' convert_output( -#' file = here::here("model1", "Report.sso"), -#' model = "ss3", +#' files = here::here("model1", "Report.sso"), +#' models = "ss3", #' fleet_names = c("TWL", "NONTWL"), #' save_dir = here::here("standard_output.rda") #' ) #' convert_output( -#' file = list("model1"=here::here("model1", "Report.sso"), "model2"=here::here("model2", "Report.sso")), -#' model = c("ss3", "ss3"), -#' fleet_names = list("model1"=c("TWL", "NONTWL"), "model2"=c("Fishery1", "Survey1", "Survey2")), +#' files = list( +#' "model1" = here::here("model1", "Report.sso"), +#' "model2" = here::here("model2", "Report.sso") +#' ), +#' models = c("ss3", "ss3"), +#' fleet_names = list( +#' "model1" = c("TWL", "NONTWL"), +#' "model2" = c("Fishery1", "Survey1", "Survey2") +#' ), #' save_dir = here::here("standard_output.rda") #' ) #' } @@ -335,7 +341,7 @@ convert_output <- function( model=model_name, year=as.character(year), month=as.character(month), - block=as.character(block), + block=as.character(.data$block), fleet=as.character(fleet) ) return(tibble::tibble(out_new)) diff --git a/R/extract_sis_data.R b/R/extract_sis_data.R index 1b1cf93f..31e33e08 100644 --- a/R/extract_sis_data.R +++ b/R/extract_sis_data.R @@ -154,7 +154,7 @@ extract_sis_data <- function(sis_data_dir = getwd(), rec <- rda[["figure"]][["layers"]][["geom_line"]][["data"]] recruitment <- rec |> dplyr::group_by(year) |> - dplyr::summarise(sum = sum(predicted_recruitment)) |> + dplyr::summarise(sum = sum(.data$predicted_recruitment)) |> dplyr::rename(Recruitment = sum) }, error = function(e) { diff --git a/R/plot_data_availability.R b/R/plot_data_availability.R index 371908dc..75aa99b2 100644 --- a/R/plot_data_availability.R +++ b/R/plot_data_availability.R @@ -118,7 +118,7 @@ plot_data_availability <- function( # fleet, and year, with `type` a factor in the order the types are plotted data_availability <- function(dat) { if (inherits(dat, "FIMSFrame")) { - dat <- methods::slot(dat, "data") + dat <- dat@data } fims_input <- is.data.frame(dat) && !"label" %in% names(dat) && all(c("type", "fleet", "timing", "observed") %in% names(dat)) diff --git a/R/plot_landings.R b/R/plot_landings.R index 7c549387..47489995 100644 --- a/R/plot_landings.R +++ b/R/plot_landings.R @@ -154,7 +154,7 @@ plot_landings <- function( labels <- unique(landings_data$label) unit_label <- prepared_data |> dplyr::filter(label %in% labels) |> - dplyr::pull(unit) |> + dplyr::pull("unit") |> unique() unit_label <- unit_label[!is.na(unit_label)][1] if (is.na(unit_label)) { diff --git a/R/table_landings.R b/R/table_landings.R index 98ecf2fc..76e2f568 100644 --- a/R/table_landings.R +++ b/R/table_landings.R @@ -133,9 +133,9 @@ table_landings <- function( cleaned_colnames <- gsub(fleet_pattern, "", colnames(table_data[[1]])) unit_label <- prepared_data |> dplyr::filter(label %in% cleaned_colnames) |> - dplyr::select(unit) |> + dplyr::select("unit") |> unique() |> - dplyr::pull(unit) + dplyr::pull("unit") if (is.na(unit_label)) { cli::cli_alert_warning("No unit label found in the data. Please provide a unit label using the 'unit_label' argument.") unit_label <- "" diff --git a/R/table_projections.R b/R/table_projections.R index b18c429a..27a5bc01 100644 --- a/R/table_projections.R +++ b/R/table_projections.R @@ -107,9 +107,9 @@ table_projections <- function( unit_label <- filtered_data |> dplyr::filter( grepl(x, unit_name), - !is.na(unit) + !is.na(.data$unit) ) |> - dplyr::pull(unit) |> + dplyr::pull("unit") |> unique() if (is.na(unit_label) || length(unit_label) == 0) { cli::cli_alert_warning("No unit label found in the data for {unit_name}. Please provide a unit label using the '{unit_name}_label' argument.") diff --git a/man/conout_bam.Rd b/man/conout_bam.Rd index 6cb63143..31817402 100644 --- a/man/conout_bam.Rd +++ b/man/conout_bam.Rd @@ -8,23 +8,19 @@ conout_bam(file, out_new, fleet_names = NULL) } \arguments{ \item{file}{Path. Assessment model output file path. Currently accepts SS3 -\code{r4ss::ss_output()} or Report.sso file (being deprecated), BAM .rda file, Rceattle model object, and FIMS output -(the tibble returned by \code{FIMS::get_estimates()}, a \code{FIMSFit} object, or an .rds file with either).} +Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.} -\item{fleet_names}{List of Character vectors. Names of fleets in the assessment model as +\item{fleet_names}{List of named character vectors. Names of fleets in the assessment model as shortened in the output file or names of fleets to replace the native fleet names in the output. For example, if fleet names in the model are 1, 2, 3 then fleet_names = c("fleet1" = 1, "fleet2" = 2, "fleet3" = 3). Default: NULL -Should match length of \code{files}.} - -\item{Path.}{Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +Should match length of \code{files} if >1 model.} } \value{ Reshaped data frame. diff --git a/man/conout_rceattle.Rd b/man/conout_rceattle.Rd index 9e9e3734..651e79e8 100644 --- a/man/conout_rceattle.Rd +++ b/man/conout_rceattle.Rd @@ -8,23 +8,19 @@ conout_rceattle(file, out_new, fleet_names = NULL) } \arguments{ \item{file}{Path. Assessment model output file path. Currently accepts SS3 -\code{r4ss::ss_output()} or Report.sso file (being deprecated), BAM .rda file, Rceattle model object, and FIMS output -(the tibble returned by \code{FIMS::get_estimates()}, a \code{FIMSFit} object, or an .rds file with either).} +Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.} -\item{fleet_names}{List of Character vectors. Names of fleets in the assessment model as +\item{fleet_names}{List of named character vectors. Names of fleets in the assessment model as shortened in the output file or names of fleets to replace the native fleet names in the output. For example, if fleet names in the model are 1, 2, 3 then fleet_names = c("fleet1" = 1, "fleet2" = 2, "fleet3" = 3). Default: NULL -Should match length of \code{files}.} - -\item{Path.}{Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +Should match length of \code{files} if >1 model.} } \value{ Reshaped data frame. diff --git a/man/conout_ss3.Rd b/man/conout_ss3.Rd index 8fdd5c43..4d8f7422 100644 --- a/man/conout_ss3.Rd +++ b/man/conout_ss3.Rd @@ -8,23 +8,19 @@ conout_ss3(file, out_new, fleet_names = NULL) } \arguments{ \item{file}{Path. Assessment model output file path. Currently accepts SS3 -\code{r4ss::ss_output()} or Report.sso file (being deprecated), BAM .rda file, Rceattle model object, and FIMS output -(the tibble returned by \code{FIMS::get_estimates()}, a \code{FIMSFit} object, or an .rds file with either).} +Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.} -\item{fleet_names}{List of Character vectors. Names of fleets in the assessment model as +\item{fleet_names}{List of named character vectors. Names of fleets in the assessment model as shortened in the output file or names of fleets to replace the native fleet names in the output. For example, if fleet names in the model are 1, 2, 3 then fleet_names = c("fleet1" = 1, "fleet2" = 2, "fleet3" = 3). Default: NULL -Should match length of \code{files}.} - -\item{Path.}{Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +Should match length of \code{files} if >1 model.} } \value{ Reshaped data frame. diff --git a/man/convert_output.Rd b/man/convert_output.Rd index 30d010e4..6ba3e0f7 100644 --- a/man/convert_output.Rd +++ b/man/convert_output.Rd @@ -4,13 +4,19 @@ \alias{convert_output} \title{Convert Output} \usage{ -convert_output(files, models = NULL, fleet_names = NULL, save_dir = NULL) +convert_output( + files, + models = NULL, + fleet_names = NULL, + save_dir = NULL, + start_year = NULL +) } \arguments{ \item{files}{List of Paths. Assessment model output file paths. Currently accepts SS3 \code{r4ss::ss_output()} or Report.sso file (being deprecated), BAM .rda file, Rceattle model object, -and FIMS output (the tibble returned by \code{FIMS::get_estimates()}, a \code{FIMSFit} object, or an -.rds file with either). If multiple elements, all valid models will be read, converted, and +and FIMS output (the tibble returned by \code{FIMS::get_estimates()}, a \code{FIMSFit} object, or an .rds +file with either). If multiple elements, all valid models will be read, converted, and appended together. \code{names(files)} will be used as the name of the model in the output.} @@ -21,16 +27,16 @@ Default: NULL Options: "ss3", "bam", "fims", "rceattle" -Should match length of \code{files}.} +Should match length of \code{files} if >1 model.} -\item{fleet_names}{List of Character vectors. Names of fleets in the assessment model as +\item{fleet_names}{List of named character vectors. Names of fleets in the assessment model as shortened in the output file or names of fleets to replace the native fleet names in the output. For example, if fleet names in the model are 1, 2, 3 then fleet_names = c("fleet1" = 1, "fleet2" = 2, "fleet3" = 3). Default: NULL -Should match length of \code{files}.} +Should match length of \code{files} if >1 model.} \item{save_dir}{Path. Full file path to save the converted output file. If saved file name is not indicated, the file will be saved as "std_output.rda" @@ -68,15 +74,21 @@ Other estimates are relabeled with \code{fims_var_names.csv} (e.g., \examples{ \dontrun{ convert_output( - file = here::here("model1", "Report.sso"), - model = "ss3", + files = here::here("model1", "Report.sso"), + models = "ss3", fleet_names = c("TWL", "NONTWL"), save_dir = here::here("standard_output.rda") ) convert_output( - file = list("model1"=here::here("model1", "Report.sso"), "model2"=here::here("model2", "Report.sso")), - model = c("ss3", "ss3"), - fleet_names = list("model1"=c("TWL", "NONTWL"), "model2"=c("Fishery1", "Survey1", "Survey2")), + files = list( + "model1" = here::here("model1", "Report.sso"), + "model2" = here::here("model2", "Report.sso") + ), + models = c("ss3", "ss3"), + fleet_names = list( + "model1" = c("TWL", "NONTWL"), + "model2" = c("Fishery1", "Survey1", "Survey2") + ), save_dir = here::here("standard_output.rda") ) } From 2f9ff7ba5d5291354ff9a9badb00de1c34bdae14 Mon Sep 17 00:00:00 2001 From: Eric Ward <5046884+ericward-noaa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:47:42 -0800 Subject: [PATCH 2/2] @param file Assessment model output file path or object in the user's environment --- R/conout_bam.R | 9 +++++---- R/conout_rceattle.R | 9 +++++---- R/conout_ss3.R | 9 +++++---- man/conout_bam.Rd | 5 +++-- man/conout_rceattle.Rd | 5 +++-- man/conout_ss3.Rd | 5 +++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/R/conout_bam.R b/R/conout_bam.R index b9f1c5a6..5c8dd8f1 100644 --- a/R/conout_bam.R +++ b/R/conout_bam.R @@ -3,10 +3,11 @@ #' Does not change naming conventions. #' #' @inheritParams convert_output -#' -#' @param file Path. Assessment model output file path. Currently accepts SS3 -#' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. -#' +#' +#' @param file Assessment model output file path or object in the user's +#' environment. Currently accepts SS3 Report.sso file, BAM .rda file, +#' Rceattle model object, and FIMS model object. +#' #' @param out_new The empty standard output data frame from #' [convert_output()], which sets the columns of the output. #' diff --git a/R/conout_rceattle.R b/R/conout_rceattle.R index 592f135f..6de96017 100644 --- a/R/conout_rceattle.R +++ b/R/conout_rceattle.R @@ -3,10 +3,11 @@ #' Does not change naming conventions. #' #' @inheritParams convert_output -#' -#' @param file Path. Assessment model output file path. Currently accepts SS3 -#' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. -#' +#' +#' @param file Assessment model output file path or object in the user's +#' environment. Currently accepts SS3 Report.sso file, BAM .rda file, +#' Rceattle model object, and FIMS model object. +#' #' @param out_new The empty standard output data frame from #' [convert_output()], which sets the columns of the output. #' diff --git a/R/conout_ss3.R b/R/conout_ss3.R index de7e4186..a1ff0aab 100644 --- a/R/conout_ss3.R +++ b/R/conout_ss3.R @@ -4,10 +4,11 @@ #' file or returned object from `r4ss::ss_output()`. #' #' @inheritParams convert_output -#' -#' @param file Path. Assessment model output file path. Currently accepts SS3 -#' Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object. -#' +#' +#' @param file Assessment model output file path or object in the user's +#' environment. Currently accepts SS3 Report.sso file, BAM .rda file, +#' Rceattle model object, and FIMS model object. +#' #' @param out_new The empty standard output data frame from #' [convert_output()], which sets the columns of the output. #' diff --git a/man/conout_bam.Rd b/man/conout_bam.Rd index 31817402..63a84326 100644 --- a/man/conout_bam.Rd +++ b/man/conout_bam.Rd @@ -7,8 +7,9 @@ conout_bam(file, out_new, fleet_names = NULL) } \arguments{ -\item{file}{Path. Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +\item{file}{Assessment model output file path or object in the user's +environment. Currently accepts SS3 Report.sso file, BAM .rda file, +Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.} diff --git a/man/conout_rceattle.Rd b/man/conout_rceattle.Rd index 651e79e8..62fd7e18 100644 --- a/man/conout_rceattle.Rd +++ b/man/conout_rceattle.Rd @@ -7,8 +7,9 @@ conout_rceattle(file, out_new, fleet_names = NULL) } \arguments{ -\item{file}{Path. Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +\item{file}{Assessment model output file path or object in the user's +environment. Currently accepts SS3 Report.sso file, BAM .rda file, +Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.} diff --git a/man/conout_ss3.Rd b/man/conout_ss3.Rd index 4d8f7422..35475c87 100644 --- a/man/conout_ss3.Rd +++ b/man/conout_ss3.Rd @@ -7,8 +7,9 @@ conout_ss3(file, out_new, fleet_names = NULL) } \arguments{ -\item{file}{Path. Assessment model output file path. Currently accepts SS3 -Report.sso file, BAM .rda file, Rceattle model object, and FIMS model object.} +\item{file}{Assessment model output file path or object in the user's +environment. Currently accepts SS3 Report.sso file, BAM .rda file, +Rceattle model object, and FIMS model object.} \item{out_new}{The empty standard output data frame from \code{\link[=convert_output]{convert_output()}}, which sets the columns of the output.}