From 5732c2b2b71d6dba54df58530d67ab264ff1b327 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Tue, 19 May 2026 16:03:34 -0400 Subject: [PATCH 1/8] Update documentation for some functions with defaults and options, as per https://github.com/nmfs-ost/stockplotr/issues/256 --- DESCRIPTION | 2 +- R/add_theme.R | 2 ++ R/html_all_figs_tables.R | 2 ++ R/plot_biomass_at_age.R | 7 ++++++- R/plot_recruitment.R | 2 ++ R/plot_stock_recruitment.R | 8 ++++++++ R/theme_noaa.R | 5 ++++- man/add_theme.Rd | 4 +++- man/html_all_figs_tables.Rd | 4 +++- man/plot_biomass_at_age.Rd | 8 ++++++-- man/plot_recruitment.Rd | 4 +++- man/plot_stock_recruitment.Rd | 12 +++++++++--- man/stockplotr-package.Rd | 1 + man/theme_noaa.Rd | 4 +++- 14 files changed, 53 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 57273285..02a7d01e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -70,4 +70,4 @@ Config/testthat/parallel: false Encoding: UTF-8 Language: en-US LazyData: true -RoxygenNote: 7.3.3 +Config/roxygen2/version: 8.0.0 diff --git a/R/add_theme.R b/R/add_theme.R index 4937e5a7..80446bb0 100644 --- a/R/add_theme.R +++ b/R/add_theme.R @@ -3,6 +3,8 @@ #' @param x table or figures object from ggplot, base r plot, gt table, flextable, or kable extra #' @param discrete TRUE/FALSE indicate if data input is discrete. Specifically applied to plots. #' +#' Default: TRUE +#' #' @returns Add the standard formatting for stock assessment reports for any #' figure or table. #' @details Currently, the function is able to format objects from: diff --git a/R/html_all_figs_tables.R b/R/html_all_figs_tables.R index 9c0fddae..dbd66981 100644 --- a/R/html_all_figs_tables.R +++ b/R/html_all_figs_tables.R @@ -5,6 +5,8 @@ #' @param figures_tables_dir The location of the folder containing #' figures and tables ("figures" and "tables"). #' +#' Default: The current working directory (`getwd()`) +#' #' @returns A folder ("all_tables_figures") in your working directory containing #' html and qmd files that show all tables and figures. #' diff --git a/R/plot_biomass_at_age.R b/R/plot_biomass_at_age.R index 1bc5e131..6754f449 100644 --- a/R/plot_biomass_at_age.R +++ b/R/plot_biomass_at_age.R @@ -5,9 +5,14 @@ #' age. For example, scale_amount = 100 would scale down a value #' from 500,000 --> 5,000. This scale will be reflected in the legend label if #' proportion is set to FALSE. +#' +#' Default: "1000" +#' #' @param interactive TRUE/FALSE; indicate whether the environment in which the #' function is operating is interactive. This bypasses some options for -#' filtering when preparing data for the plot. Default is FALSE. +#' filtering when preparing data for the plot. +#' +#' Default: FALSE #' #' @returns A plot showing total biomass at age. #' diff --git a/R/plot_recruitment.R b/R/plot_recruitment.R index 69abdd08..712f275f 100644 --- a/R/plot_recruitment.R +++ b/R/plot_recruitment.R @@ -3,6 +3,8 @@ #' @inheritParams plot_spawning_biomass #' @param unit_label units for recruitment #' +#' Default: "mt" +#' #' @returns A plot showing recruitment over time. #' #' @details The input is from an assessment model output file diff --git a/R/plot_stock_recruitment.R b/R/plot_stock_recruitment.R index 810397e8..23e6cc33 100644 --- a/R/plot_stock_recruitment.R +++ b/R/plot_stock_recruitment.R @@ -5,9 +5,17 @@ #' plot is being made in is interactive. By default, this #' is set to false. If true, dependent on your data, a #' option menu will pop-up. +#' +#' Default: TRUE +#' #' @param spawning_biomass_label Units for spawning biomass +#' +#' Default: "mt" +#' #' @param recruitment_label units for recruitment #' +#' Default: "mt" +#' #' @returns A plot showing the stock recruitment relationship. #' #' @details The input is from an assessment model output file diff --git a/R/theme_noaa.R b/R/theme_noaa.R index 58ebc5fe..6885af4c 100644 --- a/R/theme_noaa.R +++ b/R/theme_noaa.R @@ -1,6 +1,9 @@ #' Add NOAA theming to ggplot2 object. The palette is from the 'viridis' package, which contains palettes distinguishable by those with color vision deficiency. #' -#' @param discrete Variable indicating whether the color or fill aesthetic is discrete. Default is TRUE. +#' @param discrete Variable indicating whether the color or fill aesthetic is discrete. +#' +#' Default: TRUE +#' #' @param ... Arguments passed to `ggplot2::theme()`. #' #' @returns A list applying a theme to a ggplot2 object. diff --git a/man/add_theme.Rd b/man/add_theme.Rd index aabbc9e6..a8de46b0 100644 --- a/man/add_theme.Rd +++ b/man/add_theme.Rd @@ -9,7 +9,9 @@ add_theme(x, discrete = TRUE) \arguments{ \item{x}{table or figures object from ggplot, base r plot, gt table, flextable, or kable extra} -\item{discrete}{TRUE/FALSE indicate if data input is discrete. Specifically applied to plots.} +\item{discrete}{TRUE/FALSE indicate if data input is discrete. Specifically applied to plots. + +Default: TRUE} } \value{ Add the standard formatting for stock assessment reports for any diff --git a/man/html_all_figs_tables.Rd b/man/html_all_figs_tables.Rd index a04b855e..31ecc069 100644 --- a/man/html_all_figs_tables.Rd +++ b/man/html_all_figs_tables.Rd @@ -8,7 +8,9 @@ html_all_figs_tables(figures_tables_dir = getwd()) } \arguments{ \item{figures_tables_dir}{The location of the folder containing -figures and tables ("figures" and "tables").} +figures and tables ("figures" and "tables"). + +Default: The current working directory (`getwd()`)} } \value{ A folder ("all_tables_figures") in your working directory containing diff --git a/man/plot_biomass_at_age.Rd b/man/plot_biomass_at_age.Rd index cd8fe3b1..ef4716f2 100644 --- a/man/plot_biomass_at_age.Rd +++ b/man/plot_biomass_at_age.Rd @@ -27,7 +27,9 @@ summarize the data in a single plot.} \item{scale_amount}{A number describing how much to scale down the biomass at age. For example, scale_amount = 100 would scale down a value from 500,000 --> 5,000. This scale will be reflected in the legend label if -proportion is set to FALSE.} +proportion is set to FALSE. + +Default: "1000"} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size @@ -35,7 +37,9 @@ is relative to z} \item{interactive}{TRUE/FALSE; indicate whether the environment in which the function is operating is interactive. This bypasses some options for -filtering when preparing data for the plot. Default is FALSE.} +filtering when preparing data for the plot. + +Default: FALSE} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, diff --git a/man/plot_recruitment.Rd b/man/plot_recruitment.Rd index 90db10fc..5a68f50a 100644 --- a/man/plot_recruitment.Rd +++ b/man/plot_recruitment.Rd @@ -25,7 +25,9 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{unit_label}{units for recruitment} +\item{unit_label}{units for recruitment + +Default: "mt"} \item{scale_amount}{A number to scale the y-axis values. diff --git a/man/plot_stock_recruitment.Rd b/man/plot_stock_recruitment.Rd index 71049367..54ea1b73 100644 --- a/man/plot_stock_recruitment.Rd +++ b/man/plot_stock_recruitment.Rd @@ -23,14 +23,20 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{spawning_biomass_label}{Units for spawning biomass} +\item{spawning_biomass_label}{Units for spawning biomass -\item{recruitment_label}{units for recruitment} +Default: "mt"} + +\item{recruitment_label}{units for recruitment + +Default: "mt"} \item{interactive}{Indicate whether the environment the plot is being made in is interactive. By default, this is set to false. If true, dependent on your data, a -option menu will pop-up.} +option menu will pop-up. + +Default: TRUE} \item{era}{A string naming the era of data. diff --git a/man/stockplotr-package.Rd b/man/stockplotr-package.Rd index ce67c60e..0dcd782c 100644 --- a/man/stockplotr-package.Rd +++ b/man/stockplotr-package.Rd @@ -22,6 +22,7 @@ Useful links: Authors: \itemize{ + \item Samantha Schiano \email{samantha.schiano@noaa.gov} (\href{https://orcid.org/0009-0003-3744-6428}{ORCID}) \item Sophie Breitbart \email{sophie.breitbart@noaa.gov} (\href{https://orcid.org/0000-0001-9641-9786}{ORCID}) [contributor] \item Steve Saul \email{steven.saul@noaa.gov} } diff --git a/man/theme_noaa.Rd b/man/theme_noaa.Rd index 33d5d509..f84550ad 100644 --- a/man/theme_noaa.Rd +++ b/man/theme_noaa.Rd @@ -7,7 +7,9 @@ theme_noaa(discrete = TRUE, ...) } \arguments{ -\item{discrete}{Variable indicating whether the color or fill aesthetic is discrete. Default is TRUE.} +\item{discrete}{Variable indicating whether the color or fill aesthetic is discrete. + +Default: TRUE} \item{...}{Arguments passed to `ggplot2::theme()`.} } From e45694ab5f355844faa04e2146b4b5c679a6fc51 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Tue, 19 May 2026 17:04:05 -0400 Subject: [PATCH 2/8] Batch 2: Update documentation for more functions with defaults and options, as per https://github.com/nmfs-ost/stockplotr/issues/256 --- R/plot_biomass_at_age.R | 2 +- R/plot_indices.R | 10 ++- R/plot_spawning_biomass.R | 2 + R/process_data.R | 22 ++++-- R/utils_plot.R | 112 +++++++++++++++-------------- R/utils_table.R | 2 + man/check_label_differences.Rd | 4 +- man/filter_data.Rd | 56 ++++++++++----- man/plot_aa.Rd | 35 ++++++--- man/plot_biomass.Rd | 4 +- man/plot_biomass_at_age.Rd | 2 +- man/plot_error.Rd | 38 +++++++--- man/plot_fishing_mortality.Rd | 4 +- man/plot_indices.Rd | 19 +++-- man/plot_landings.Rd | 4 +- man/plot_natural_mortality.Rd | 4 +- man/plot_obsvpred.Rd | 39 +++++++--- man/plot_recruitment.Rd | 4 +- man/plot_recruitment_deviations.Rd | 1 + man/plot_spawning_biomass.Rd | 4 +- man/plot_stock_recruitment.Rd | 1 + man/plot_timeseries.Rd | 32 ++++++--- man/process_data.Rd | 20 ++++-- man/process_table.Rd | 22 ++++-- man/reference_line.Rd | 5 +- man/table_landings.Rd | 1 + 26 files changed, 304 insertions(+), 145 deletions(-) diff --git a/R/plot_biomass_at_age.R b/R/plot_biomass_at_age.R index 6754f449..7766eb67 100644 --- a/R/plot_biomass_at_age.R +++ b/R/plot_biomass_at_age.R @@ -12,7 +12,7 @@ #' function is operating is interactive. This bypasses some options for #' filtering when preparing data for the plot. #' -#' Default: FALSE +#' Default: `FALSE` #' #' @returns A plot showing total biomass at age. #' diff --git a/R/plot_indices.R b/R/plot_indices.R index a7ef9f6a..e9932ae9 100644 --- a/R/plot_indices.R +++ b/R/plot_indices.R @@ -1,12 +1,18 @@ #' Plot Index of Abundance #' #' @inheritParams plot_spawning_biomass -#' @param facet a string or vector of strings of a column that facets the data -#' (e.g. "year", "area", etc.) "fleet" is always added on to any faceting selections +#' @param facet a string or vector of strings of a column that facets the data. "fleet" is always added on to any faceting selections +#' +#' Default: NULL +#' +#' Options: May include, but is not limited to: "fleet", "year", "area", NULL #' @param unit_label units for index of abundance/CPUE +#' +#' Default: "" #' @param focus a string or vector of strings indicating how data should be #' filtered. (i.e. select names of fleets to zoom into the plot) #' +#' Default: NULL #' @returns A plot showing the expected and predicted indices. #' #' @details The input is from an assessment model output file diff --git a/R/plot_spawning_biomass.R b/R/plot_spawning_biomass.R index 9938c80c..d0b0f09d 100644 --- a/R/plot_spawning_biomass.R +++ b/R/plot_spawning_biomass.R @@ -19,6 +19,7 @@ #' Set group = "none" to summarize data over all indexing values. #' #' Default: NULL +#' Options: "year", "area", "fleet", "none" #' @param facet A string or vector of strings of a column name. #' #' Default: NULL @@ -42,6 +43,7 @@ #' #' Default: `FALSE` #' @param module (Optional) A string indicating the module_name found in `dat`. +#' If selecting >1 module, place them in a vector like c("module1", "module2"). #' #' Default: NULL #' diff --git a/R/process_data.R b/R/process_data.R index 78660a55..0d244bdb 100644 --- a/R/process_data.R +++ b/R/process_data.R @@ -6,17 +6,29 @@ #' #' @param dat Pre-filtered data from \link[stockplotr]{filter_data} following a #' long format data. -#' @param group A string identifying the indexing variable of the data. If you -#' want to just summarize the data across all factors, set group = "none". +#' @param group A string identifying the indexing variable of the data. +#' To remove any groups and summarize data across all factors, set +#' group = "none". Setting group = NULL will keep any grouping +#' variables identified in the data by the function. +#' +#' Default: NULL +#' +#' Options: Including, but not limited to: "none", NULL #' @param facet A string or vector of strings identifying the faceting #' variable(s) of the data. +#' +#' Default: NULL #' @param lbs A logical value indicating whether to convert the y-axis values from #' kilograms to pounds. The default units match the default in the #' unit_label argument - 'metric tons'. #' #' Default: `FALSE` #' @param method A string describing the method of summarizing data when group -#' is set to "none". Options are "sum" or "mean". Default is "sum". +#' is set to "none". +#' +#' Default: "sum" +#' +#' Options: "sum" or "mean" #' #' @returns List of 3 objects: #' \item{data}{A data frame of the processed data ready for plotting.} @@ -360,6 +372,8 @@ process_data <- function( #' #' @inheritParams process_data #' @param label A string or vector of strings identifying the label values to filter the data. +#' +#' Default: NULL #' #' @returns A dataframe of processed data ready for formatting into a table. #' @details Input is an object created with \link[stockplotr]{filter_data}. @@ -369,7 +383,7 @@ process_data <- function( #' @examples { #' filtered <- filter_data( #' dat = stockplotr:::example_data, -#' label_name = "landings", +#' label = "landings", #' geom = "line", #' era = "time" #' ) diff --git a/R/utils_plot.R b/R/utils_plot.R index 16918a83..007b7cde 100644 --- a/R/utils_plot.R +++ b/R/utils_plot.R @@ -6,19 +6,34 @@ #' #' @param dat filtered data frame from standard output file(s) preformatted for #' the target label from \link[stockplotr]{filter_data} -#' @param x a string of the column name of data used to plot on the x-axis (default -#' is "year") -#' @param y a string of the column name of data used to plot on the y-axis (default -#' is "estimate") +#' @param x a string of the column name of data used to plot on the x-axis +#' +#' Default: "year" +#' @param y a string of the column name of data used to plot on the y-axis +#' +#' Default: "estimate" +#' #' @param geom type of geom to use for plotting found in ggplot2 (e.g. "point", -#' "line", etc.). Default is "line". Other options are "point" and "area". -#' @param xlab a string of the x-axis label (default is "Year") +#' "line", etc.). +#' +#' Default: "line" +#' +#' Options: "point" and "area" +#' @param xlab a string of the x-axis label +#' +#' Default: "Year" #' @param ylab a string of the y-axis label. If NULL, it will be set to the name #' of `y`. +#' +#' Default: NULL #' @param group a string of a single column that groups the data (e.g. "fleet", #' "sex", "area", etc.). Currently can only have one level of grouping. +#' +#' Default: NULL #' @param facet a string or vector of strings of a column that facets the data #' (e.g. "year", "area", etc.) +#' +#' Default: NULL #' @param ... inherited arguments from internal functions from ggplot2::geom_xx #' #' @@ -218,22 +233,10 @@ plot_timeseries <- function( #' Create plot with error #' -#' @param dat filtered data frame from standard output file(s) preformatted for -#' the target label from \link[stockplotr]{process_data} -#' @param x a string of the column name of data used to plot on the x-axis (default -#' is "year") -#' @param y a string of the column name of data used to plot on the y-axis (default -#' is "estimate") -#' @param geom type of geom to use for plotting found in ggplot2 (e.g. "point", -#' "line", etc.). Default is "line". Other options are "point" and "area". -#' @param xlab a string of the x-axis label (default is "Year") -#' @param ylab a string of the y-axis label. If NULL, it will be set to the name -#' of `y`. -#' @param group a string of a single column that groups the data (e.g. "fleet", -#' "sex", "area", etc.). Currently can only have one level of grouping. -#' @param facet a string or vector of strings of a column that facets the data -#' (e.g. "year", "area", etc.) +#' @inheritParams plot_timeseries #' @param hline indicate true or false to place a horizontal line at 1 +#' +#' Default: `TRUE` #' @param ... inherited arguments from internal functions from ggplot2::geom_xx #' #' @returns Create a plot with error for a stock assessment report. @@ -301,24 +304,36 @@ plot_error <- function( #' Create "at-age" plot #' -#' @param dat filtered data frame from standard output file(s) preformatted for -#' the target label from \link[stockplotr]{filter_data} -#' @param x a string of the column name of data used to plot on the x-axis -#' (default is "year") +#' @inheritParams plot_timeseries #' @param y a string of the column name of data used to plot on the y-axis -#' (default is "age") +#' +#' Default: "age" #' @param z a string of the column name of data used to control the size of the -#' bubbles (default is "estimate") +#' bubbles +#' +#' Default: "estimate" #' @param label a string of the label for the size of the bubbles -#' (default is "Abundance") -#' @param xlab a string of the x-axis label (default is "Year") -#' @param ylab a string of the y-axis label (default is "Age") -#' @param facet a string or vector of strings of a column that facets the data -#' (e.g. "sex", "area", etc.). It is not recommended to include more than one -#' facet due to the complexity of the plot. +#' +#' Default: "Abundance" +#' +#' @param xlab a string of the x-axis label +#' +#' Default: "Year" +#' @param ylab a string of the y-axis label +#' +#' Default: "Age" +#' @param facet a string or vector of strings of a column that facets the data. +#' It is not recommended to include more than one facet due to the complexity +#' of the plot. +#' +#' Default: NULL +#' +#' Options: Including, but not limited to: "sex", "area", "fleet" #' @param proportional Set size of points relative to z when TRUE, point #' size are relative to one another while when set to FALSE, point size #' is relative to z +#' +#' Default: `TRUE` #' @param ... inherited arguments from internal functions from #' \link[ggplot2]{geom_point} #' @@ -512,8 +527,9 @@ cohort_line <- function( #' @param dat standard data frame where reference point should be extracted #' @param label_name string of the name of the quantity that users want to #' extract the reference point from -#' @param reference string. name of the reference point such as "msy", -#' "unfished", or "target" +#' @param reference string of the reference point +#' +#' Options: Including, but not limited to: "msy", "unfished", "target" #' #' @returns A ggplot2 geom_hline object for a reference point that can be added #' to a plot @@ -617,26 +633,9 @@ cap_first_letter <- function(s) { #' Filter data for input into aesthetics for ggplot2 #' -#' @param dat a data frame or list of data frames input as `list()` that -#' contains the data to be plotted. +#' @inheritParams plot_spawning_biomass #' @param label_name a string of the name of the label that is used to filter #' the data. -#' @param geom Type of plot user wants to create. Options are "line", "point", -#' and "area". -#' @param group Name of a column selected grouping for the data. -#' @param facet a string or vector of strings of a column that facets the data -#' (e.g. "year", "area", etc.) -#' @param era A string naming the era of data such as historical ("early"), current ("time"), or -#' projected ("fore") data if filtering should occur. Default is set to "time" which is -#' the current time. To plot all data, set era to NULL. -#' @param scale_amount A number describing how much to scale down the quantities -#' shown on the y axis. -#' @param interactive logical. If TRUE, the user will be prompted to select -#' a module_name when there was more than one found in the filtered data set. -#' @param module (Optional) A string indicating the linked module_name associated -#' with the label for the plot if known. Default is NULL. By default, the function -#' will select the most relevant module if more than 1 exists. If selecting more -#' than one module, place them in a vector such as c("module1", "module2"). #' #' @returns a data frame that is preformatted for plotting with ggplot2. #' @export @@ -1017,8 +1016,11 @@ check_grouping <- function(dat) { #' Plot observed vs. predicted data #' #' @inheritParams plot_timeseries -#' @param observed_label a string of the label used to filter the observed data. Default is "observed". -#' @param predicted_label a string of the label used to filter the predicted data. Default is "predicted". +#' @param observed_label a string of the label used to filter the observed data +#' +#' Default: "observed" +#' @param predicted_label a string of the label used to filter the predicted data +#' Default: "predicted" #' #' @returns A plot of observed vs. predicted data for a stock assessment report. #' @export diff --git a/R/utils_table.R b/R/utils_table.R index c7fe4ffe..5ffbc3b4 100644 --- a/R/utils_table.R +++ b/R/utils_table.R @@ -106,6 +106,8 @@ create_latex_table <- function(data, #' @param dat input data into process_table #' @param index_variables the index_variables vector created within process_table #' @param id_group the identifying index variable as a string +#' +#' Default: NULL check_label_differences <- function(dat, index_variables, id_group = NULL) { # Loop over model to perform checks if the model columns are identical diff --git a/man/check_label_differences.Rd b/man/check_label_differences.Rd index 06dc1dfc..be1e5497 100644 --- a/man/check_label_differences.Rd +++ b/man/check_label_differences.Rd @@ -11,7 +11,9 @@ check_label_differences(dat, index_variables, id_group = NULL) \item{index_variables}{the index_variables vector created within process_table} -\item{id_group}{the identifying index variable as a string} +\item{id_group}{the identifying index variable as a string + +Default: NULL} } \description{ Create loop to test for differences in column values diff --git a/man/filter_data.Rd b/man/filter_data.Rd index a20eaa86..9ee6c065 100644 --- a/man/filter_data.Rd +++ b/man/filter_data.Rd @@ -17,34 +17,54 @@ filter_data( ) } \arguments{ -\item{dat}{a data frame or list of data frames input as `list()` that -contains the data to be plotted.} +\item{dat}{A tibble or named list of tibbles (input as `list()`) +returned from \link[stockplotr]{convert_output}. + +If inputting a list of tibbles, the first tibble's reference point defined +in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} \item{label_name}{a string of the name of the label that is used to filter the data.} -\item{module}{(Optional) A string indicating the linked module_name associated -with the label for the plot if known. Default is NULL. By default, the function -will select the most relevant module if more than 1 exists. If selecting more -than one module, place them in a vector such as c("module1", "module2").} +\item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). + +Default: NULL + +If the interactive and >1 module_name is found, user will select the +module_name in the console. @seealso [filter_data()]} + +\item{era}{A string naming the era of data. + +Default: "time" + +Options: "early", "time", "fore" (forecast), or NULL (all data)} + +\item{geom}{A string stating the geom used for the plot. + +Default: "line". + +Options: "line", "point", or "area"} + +\item{group}{A string of a single column that groups the data (e.g. "fleet", +"sex", "area", etc.). + +Set group = "none" to summarize data over all indexing values. + +Default: NULL +Options: "year", "area", "fleet", "none"} -\item{era}{A string naming the era of data such as historical ("early"), current ("time"), or -projected ("fore") data if filtering should occur. Default is set to "time" which is -the current time. To plot all data, set era to NULL.} +\item{facet}{A string or vector of strings of a column name. -\item{geom}{Type of plot user wants to create. Options are "line", "point", -and "area".} +Default: NULL} -\item{group}{Name of a column selected grouping for the data.} +\item{scale_amount}{A number to scale the y-axis values. -\item{facet}{a string or vector of strings of a column that facets the data -(e.g. "year", "area", etc.)} +Default: 1} -\item{scale_amount}{A number describing how much to scale down the quantities -shown on the y axis.} +\item{interactive}{A logical value indicating if the environment is interactive. -\item{interactive}{logical. If TRUE, the user will be prompted to select -a module_name when there was more than one found in the filtered data set.} +Default: `FALSE`} } \value{ a data frame that is preformatted for plotting with ggplot2. diff --git a/man/plot_aa.Rd b/man/plot_aa.Rd index d14ccfa8..178e7611 100644 --- a/man/plot_aa.Rd +++ b/man/plot_aa.Rd @@ -22,28 +22,43 @@ plot_aa( the target label from \link[stockplotr]{filter_data}} \item{x}{a string of the column name of data used to plot on the x-axis -(default is "year")} + +Default: "year"} \item{y}{a string of the column name of data used to plot on the y-axis -(default is "age")} + +Default: "age"} \item{z}{a string of the column name of data used to control the size of the -bubbles (default is "estimate")} +bubbles + +Default: "estimate"} \item{label}{a string of the label for the size of the bubbles -(default is "Abundance")} -\item{xlab}{a string of the x-axis label (default is "Year")} +Default: "Abundance"} + +\item{xlab}{a string of the x-axis label + +Default: "Year"} -\item{ylab}{a string of the y-axis label (default is "Age")} +\item{ylab}{a string of the y-axis label -\item{facet}{a string or vector of strings of a column that facets the data -(e.g. "sex", "area", etc.). It is not recommended to include more than one -facet due to the complexity of the plot.} +Default: "Age"} + +\item{facet}{a string or vector of strings of a column that facets the data. +It is not recommended to include more than one facet due to the complexity +of the plot. + +Default: NULL + +Options: Including, but not limited to: "sex", "area", "fleet"} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size -is relative to z} +is relative to z + +Default: `TRUE`} \item{...}{inherited arguments from internal functions from \link[ggplot2]{geom_point}} diff --git a/man/plot_biomass.Rd b/man/plot_biomass.Rd index 794e45f3..c82e9f02 100644 --- a/man/plot_biomass.Rd +++ b/man/plot_biomass.Rd @@ -39,7 +39,8 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -63,6 +64,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} \item{unit_label}{units for biomass} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_biomass_at_age.Rd b/man/plot_biomass_at_age.Rd index ef4716f2..a7f1db6a 100644 --- a/man/plot_biomass_at_age.Rd +++ b/man/plot_biomass_at_age.Rd @@ -39,7 +39,7 @@ is relative to z} function is operating is interactive. This bypasses some options for filtering when preparing data for the plot. -Default: FALSE} +Default: `FALSE`} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, diff --git a/man/plot_error.Rd b/man/plot_error.Rd index 6257ee30..58982737 100644 --- a/man/plot_error.Rd +++ b/man/plot_error.Rd @@ -19,29 +19,45 @@ plot_error( } \arguments{ \item{dat}{filtered data frame from standard output file(s) preformatted for -the target label from \link[stockplotr]{process_data}} +the target label from \link[stockplotr]{filter_data}} -\item{x}{a string of the column name of data used to plot on the x-axis (default -is "year")} +\item{x}{a string of the column name of data used to plot on the x-axis -\item{y}{a string of the column name of data used to plot on the y-axis (default -is "estimate")} +Default: "year"} + +\item{y}{a string of the column name of data used to plot on the y-axis + +Default: "estimate"} \item{geom}{type of geom to use for plotting found in ggplot2 (e.g. "point", -"line", etc.). Default is "line". Other options are "point" and "area".} +"line", etc.). + +Default: "line" + +Options: "point" and "area"} \item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping.} +"sex", "area", etc.). Currently can only have one level of grouping. + +Default: NULL} \item{facet}{a string or vector of strings of a column that facets the data -(e.g. "year", "area", etc.)} +(e.g. "year", "area", etc.) -\item{xlab}{a string of the x-axis label (default is "Year")} +Default: NULL} + +\item{xlab}{a string of the x-axis label + +Default: "Year"} \item{ylab}{a string of the y-axis label. If NULL, it will be set to the name -of `y`.} + of `y`. + +Default: NULL} + +\item{hline}{indicate true or false to place a horizontal line at 1 -\item{hline}{indicate true or false to place a horizontal line at 1} +Default: `TRUE`} \item{...}{inherited arguments from internal functions from ggplot2::geom_xx} } diff --git a/man/plot_fishing_mortality.Rd b/man/plot_fishing_mortality.Rd index 7b7305e7..29f48ee1 100644 --- a/man/plot_fishing_mortality.Rd +++ b/man/plot_fishing_mortality.Rd @@ -36,7 +36,8 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -56,6 +57,7 @@ Default: "time" Options: "early", "time", "fore" (forecast), or NULL (all data)} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_indices.Rd b/man/plot_indices.Rd index ce695a27..a94017e1 100644 --- a/man/plot_indices.Rd +++ b/man/plot_indices.Rd @@ -24,23 +24,30 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{unit_label}{units for index of abundance/CPUE} +\item{unit_label}{units for index of abundance/CPUE + +Default: ""} \item{group}{A string of a single column that groups the data (e.g. "fleet", "sex", "area", etc.). Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} + +\item{facet}{a string or vector of strings of a column that facets the data. "fleet" is always added on to any faceting selections -\item{facet}{a string or vector of strings of a column that facets the data -(e.g. "year", "area", etc.) "fleet" is always added on to any faceting selections} +Default: NULL + +Options: May include, but is not limited to: "fleet", "year", "area", NULL} \item{interactive}{A logical value indicating if the environment is interactive. Default: `FALSE`} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL @@ -48,7 +55,9 @@ If the interactive and >1 module_name is found, user will select the module_name in the console. @seealso [filter_data()]} \item{focus}{a string or vector of strings indicating how data should be -filtered. (i.e. select names of fleets to zoom into the plot)} +filtered. (i.e. select names of fleets to zoom into the plot) + +Default: NULL} \item{make_rda}{A logical value indicating whether to save the object and make an automated caption and alternative text in the form of an `rda` object. If TRUE, diff --git a/man/plot_landings.Rd b/man/plot_landings.Rd index 534fde54..8ec12f2e 100644 --- a/man/plot_landings.Rd +++ b/man/plot_landings.Rd @@ -42,7 +42,8 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -65,6 +66,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} Default: 1} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_natural_mortality.Rd b/man/plot_natural_mortality.Rd index 97885ed7..1e6ed3fc 100644 --- a/man/plot_natural_mortality.Rd +++ b/man/plot_natural_mortality.Rd @@ -28,7 +28,8 @@ in `ref_line` is used to plot a reference line or calculate relative spawning bi Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -45,6 +46,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} Default: `FALSE`} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_obsvpred.Rd b/man/plot_obsvpred.Rd index a0e2ed1a..7fe89e42 100644 --- a/man/plot_obsvpred.Rd +++ b/man/plot_obsvpred.Rd @@ -22,29 +22,46 @@ plot_obsvpred( \item{dat}{filtered data frame from standard output file(s) preformatted for the target label from \link[stockplotr]{filter_data}} -\item{x}{a string of the column name of data used to plot on the x-axis (default -is "year")} +\item{x}{a string of the column name of data used to plot on the x-axis -\item{y}{a string of the column name of data used to plot on the y-axis (default -is "estimate")} +Default: "year"} -\item{observed_label}{a string of the label used to filter the observed data. Default is "observed".} +\item{y}{a string of the column name of data used to plot on the y-axis -\item{predicted_label}{a string of the label used to filter the predicted data. Default is "predicted".} +Default: "estimate"} + +\item{observed_label}{a string of the label used to filter the observed data + +Default: "observed"} + +\item{predicted_label}{a string of the label used to filter the predicted data +Default: "predicted"} \item{geom}{type of geom to use for plotting found in ggplot2 (e.g. "point", -"line", etc.). Default is "line". Other options are "point" and "area".} +"line", etc.). + +Default: "line" + +Options: "point" and "area"} -\item{xlab}{a string of the x-axis label (default is "Year")} +\item{xlab}{a string of the x-axis label + +Default: "Year"} \item{ylab}{a string of the y-axis label. If NULL, it will be set to the name -of `y`.} + of `y`. + +Default: NULL} \item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping.} +"sex", "area", etc.). Currently can only have one level of grouping. + +Default: NULL} \item{facet}{a string or vector of strings of a column that facets the data -(e.g. "year", "area", etc.)} +(e.g. "year", "area", etc.) + +Default: NULL} \item{...}{inherited arguments from internal functions from ggplot2::geom_xx} } diff --git a/man/plot_recruitment.Rd b/man/plot_recruitment.Rd index 5a68f50a..f0920386 100644 --- a/man/plot_recruitment.Rd +++ b/man/plot_recruitment.Rd @@ -44,7 +44,8 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -55,6 +56,7 @@ Default: NULL} Default: `FALSE`} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_recruitment_deviations.Rd b/man/plot_recruitment_deviations.Rd index 50e5e034..835bc532 100644 --- a/man/plot_recruitment_deviations.Rd +++ b/man/plot_recruitment_deviations.Rd @@ -22,6 +22,7 @@ If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_spawning_biomass.Rd b/man/plot_spawning_biomass.Rd index fff4f851..5d9f1af0 100644 --- a/man/plot_spawning_biomass.Rd +++ b/man/plot_spawning_biomass.Rd @@ -40,7 +40,8 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. -Default: NULL} +Default: NULL +Options: "year", "area", "fleet", "none"} \item{facet}{A string or vector of strings of a column name. @@ -70,6 +71,7 @@ unit_label argument - 'metric tons'. Default: `FALSE`} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_stock_recruitment.Rd b/man/plot_stock_recruitment.Rd index 54ea1b73..abcfa2c9 100644 --- a/man/plot_stock_recruitment.Rd +++ b/man/plot_stock_recruitment.Rd @@ -45,6 +45,7 @@ Default: "time" Options: "early", "time", "fore" (forecast), or NULL (all data)} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL diff --git a/man/plot_timeseries.Rd b/man/plot_timeseries.Rd index e9c81a13..7d8847f8 100644 --- a/man/plot_timeseries.Rd +++ b/man/plot_timeseries.Rd @@ -20,25 +20,39 @@ plot_timeseries( \item{dat}{filtered data frame from standard output file(s) preformatted for the target label from \link[stockplotr]{filter_data}} -\item{x}{a string of the column name of data used to plot on the x-axis (default -is "year")} +\item{x}{a string of the column name of data used to plot on the x-axis -\item{y}{a string of the column name of data used to plot on the y-axis (default -is "estimate")} +Default: "year"} + +\item{y}{a string of the column name of data used to plot on the y-axis + +Default: "estimate"} \item{geom}{type of geom to use for plotting found in ggplot2 (e.g. "point", -"line", etc.). Default is "line". Other options are "point" and "area".} +"line", etc.). + +Default: "line" + +Options: "point" and "area"} -\item{xlab}{a string of the x-axis label (default is "Year")} +\item{xlab}{a string of the x-axis label + +Default: "Year"} \item{ylab}{a string of the y-axis label. If NULL, it will be set to the name -of `y`.} + of `y`. + +Default: NULL} \item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping.} +"sex", "area", etc.). Currently can only have one level of grouping. + +Default: NULL} \item{facet}{a string or vector of strings of a column that facets the data -(e.g. "year", "area", etc.)} +(e.g. "year", "area", etc.) + +Default: NULL} \item{...}{inherited arguments from internal functions from ggplot2::geom_xx} } diff --git a/man/process_data.Rd b/man/process_data.Rd index ce7bb7cb..9c88a64c 100644 --- a/man/process_data.Rd +++ b/man/process_data.Rd @@ -10,11 +10,19 @@ process_data(dat, group = NULL, facet = NULL, lbs = FALSE, method = "sum") \item{dat}{Pre-filtered data from \link[stockplotr]{filter_data} following a long format data.} -\item{group}{A string identifying the indexing variable of the data. If you -want to just summarize the data across all factors, set group = "none".} +\item{group}{A string identifying the indexing variable of the data. +To remove any groups and summarize data across all factors, set +group = "none". Setting group = NULL will keep any grouping +variables identified in the data by the function. + +Default: NULL + +Options: Including, but not limited to: "none", NULL} \item{facet}{A string or vector of strings identifying the faceting -variable(s) of the data.} +variable(s) of the data. + +Default: NULL} \item{lbs}{A logical value indicating whether to convert the y-axis values from kilograms to pounds. The default units match the default in the @@ -23,7 +31,11 @@ unit_label argument - 'metric tons'. Default: `FALSE`} \item{method}{A string describing the method of summarizing data when group -is set to "none". Options are "sum" or "mean". Default is "sum".} +is set to "none". + +Default: "sum" + +Options: "sum" or "mean"} } \value{ List of 3 objects: diff --git a/man/process_table.Rd b/man/process_table.Rd index d833c106..35dd049b 100644 --- a/man/process_table.Rd +++ b/man/process_table.Rd @@ -10,13 +10,25 @@ process_table(dat, group = NULL, method = "sum", label = NULL) \item{dat}{Pre-filtered data from \link[stockplotr]{filter_data} following a long format data.} -\item{group}{A string identifying the indexing variable of the data. If you -want to just summarize the data across all factors, set group = "none".} +\item{group}{A string identifying the indexing variable of the data. +To remove any groups and summarize data across all factors, set +group = "none". Setting group = NULL will keep any grouping +variables identified in the data by the function. + +Default: NULL + +Options: Including, but not limited to: "none", NULL} \item{method}{A string describing the method of summarizing data when group -is set to "none". Options are "sum" or "mean". Default is "sum".} +is set to "none". + +Default: "sum" + +Options: "sum" or "mean"} + +\item{label}{A string or vector of strings identifying the label values to filter the data. -\item{label}{A string or vector of strings identifying the label values to filter the data.} +Default: NULL} } \value{ A dataframe of processed data ready for formatting into a table. @@ -31,7 +43,7 @@ Input is an object created with \link[stockplotr]{filter_data}. { filtered <- filter_data( dat = stockplotr:::example_data, - label_name = "landings", + label = "landings", geom = "line", era = "time" ) diff --git a/man/reference_line.Rd b/man/reference_line.Rd index fc8fade9..e4f460c5 100644 --- a/man/reference_line.Rd +++ b/man/reference_line.Rd @@ -14,8 +14,9 @@ reference_line(plot, dat, label_name, reference, scale_amount = 1, lbs = FALSE) \item{label_name}{string of the name of the quantity that users want to extract the reference point from} -\item{reference}{string. name of the reference point such as "msy", -"unfished", or "target"} +\item{reference}{string of the reference point + +Options: Including, but not limited to: "msy", "unfished", "target"} \item{scale_amount}{A number to scale the y-axis values. diff --git a/man/table_landings.Rd b/man/table_landings.Rd index 1e07bc63..e582f105 100644 --- a/man/table_landings.Rd +++ b/man/table_landings.Rd @@ -43,6 +43,7 @@ want to just summarize the data across all factors, set group = "none".} is set to "none". Options are "sum" or "mean". Default is "sum".} \item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). Default: NULL From e34f62eee5929908ee376603534d59add4ee44b4 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Tue, 19 May 2026 17:24:37 -0400 Subject: [PATCH 3/8] Batch 3: Update documentation for more functions with defaults and options, as per https://github.com/nmfs-ost/stockplotr/issues/256 --- R/convert_output.R | 11 +++++++++-- R/plot_biomass.R | 15 ++++++++++----- R/plot_spawning_biomass.R | 3 +-- R/table_indices.R | 2 +- R/table_landings.R | 20 +++++++++++++++++--- man/convert_output.Rd | 15 +++++++++++---- man/filter_data.Rd | 3 +-- man/plot_biomass.Rd | 24 ++++++++++++++---------- man/plot_fishing_mortality.Rd | 3 +-- man/plot_indices.Rd | 3 +-- man/plot_landings.Rd | 3 +-- man/plot_natural_mortality.Rd | 3 +-- man/plot_recruitment.Rd | 3 +-- man/plot_spawning_biomass.Rd | 3 +-- man/table_landings.Rd | 26 ++++++++++++++++++++------ 15 files changed, 90 insertions(+), 47 deletions(-) diff --git a/R/convert_output.R b/R/convert_output.R index 92aff989..e4efb507 100644 --- a/R/convert_output.R +++ b/R/convert_output.R @@ -3,12 +3,19 @@ #' Format stock assessment output files to a standardized format. #' #' @param file Assessment model output file path -#' @param model Assessment model used in evaluation ("ss3", "bam", -#' "fims", "rceattle). +#' @param model Assessment model used in evaluation +#' +#' Default: NULL +#' +#' Options: "ss3", "bam", "fims", "rceattle" #' @param fleet_names Names of fleets in the assessment model as #' shortened in the output file. If fleet names are not properly read, then #' indicate the fleets names as an acronym in a vector +#' +#' Default: NULL #' @param save_dir File path to save the converted output file. +#' +#' Default: NULL #' #' @author Samantha Schiano #' diff --git a/R/plot_biomass.R b/R/plot_biomass.R index 8c41ba6e..6a9ddd6b 100644 --- a/R/plot_biomass.R +++ b/R/plot_biomass.R @@ -2,14 +2,19 @@ #' #' @inheritParams plot_spawning_biomass #' @param unit_label units for biomass +#' +#' Default: "metric tons" #' @param ref_line A string specifying the type of reference you want to -#' compare biomass to. The default is `"msy"`, which looks for +#' compare biomass to. The default `"msy"` looks for #' `"biomass_msy"` in the `"label"` column of `dat`. The actual -#' searching in `dat` is case agnostic and will work with either upper- or -#' lower-case letters but you must use one of the options specified in the +#' searching in `dat` is case-agnostic and will work with either upper- or +#' lower-case letters. However, you must use one of the options specified in the #' default list to ensure that the label on the figure looks correct -#' regardless of how it is specified in `dat`. Other possibilities may include -#' "target", "MSY", and "unfished". +#' regardless of how it is specified in `dat`. +#' +#' Default: "msy" +#' +#' Options: Including, but not limited to: "target", "MSY", "unfished" #' @returns A plot showing total biomass. #' #' @details The input is from an assessment model output file diff --git a/R/plot_spawning_biomass.R b/R/plot_spawning_biomass.R index d0b0f09d..dc87b911 100644 --- a/R/plot_spawning_biomass.R +++ b/R/plot_spawning_biomass.R @@ -13,8 +13,7 @@ #' Default: "line". #' #' Options: "line", "point", or "area" -#' @param group A string of a single column that groups the data (e.g. "fleet", -#' "sex", "area", etc.). +#' @param group A string of a single column that groups the data. #' #' Set group = "none" to summarize data over all indexing values. #' diff --git a/R/table_indices.R b/R/table_indices.R index 63206eb4..90b20992 100644 --- a/R/table_indices.R +++ b/R/table_indices.R @@ -3,7 +3,7 @@ # #' @inheritParams plot_recruitment # #' @param tables_dir The location of the folder containing the generated table # #' rda files ("tables") that will be created if the argument `make_rda` = TRUE. -# #' Default is the working directory. +# #' Default: the working directory (`getwd()`) # #' @returns A table of observed annual indices of abundance plus error # #' stratified by fleet. # #' @details The input is from an assessment model output file diff --git a/R/table_landings.R b/R/table_landings.R index 52d14eac..88243214 100644 --- a/R/table_landings.R +++ b/R/table_landings.R @@ -2,16 +2,30 @@ #' #' @inheritParams plot_recruitment #' @param unit_label Abbreviated units of landings -#' @param group A string identifying the indexing variable of the data. If you -#' want to just summarize the data across all factors, set group = "none". +#' +#' Default: "mt" +#' @param group A string of a single column that groups the data. +#' +#' Set group = "none" to summarize data over all indexing values. +#' +#' Default: NULL +#' Options: "year", "area", "fleet", "none" #' @param method A string describing the method of summarizing data when group -#' is set to "none". Options are "sum" or "mean". Default is "sum". +#' is set to "none". +#' +#' Default: "sum" +#' +#' Options: "sum" or "mean" #' @param tables_dir The location of the folder containing the generated table #' rda files ("tables") that will be created if the argument `make_rda` = TRUE. +#' +#' Default: the working directory (`getwd()`) #' @param label The label that will be chosen from the input file. If unspecified, #' the function will search the "label" column and use the first matching label #' in this ordered list: "landings_weight", "landings_numbers", "landings_expected", #' "landings_predicted", "landings". +#' +#' Default: NULL #' #' @returns A table ready of landed catch by fleet and year. #' diff --git a/man/convert_output.Rd b/man/convert_output.Rd index 5dad2c6e..ce7974db 100644 --- a/man/convert_output.Rd +++ b/man/convert_output.Rd @@ -9,14 +9,21 @@ convert_output(file, model = NULL, fleet_names = NULL, save_dir = NULL) \arguments{ \item{file}{Assessment model output file path} -\item{model}{Assessment model used in evaluation ("ss3", "bam", -"fims", "rceattle).} +\item{model}{Assessment model used in evaluation + +Default: NULL + +Options: "ss3", "bam", "fims", "rceattle"} \item{fleet_names}{Names of fleets in the assessment model as shortened in the output file. If fleet names are not properly read, then -indicate the fleets names as an acronym in a vector} +indicate the fleets names as an acronym in a vector + +Default: NULL} + +\item{save_dir}{File path to save the converted output file. -\item{save_dir}{File path to save the converted output file.} +Default: NULL} } \value{ A reformatted and standardized version of assessment model results diff --git a/man/filter_data.Rd b/man/filter_data.Rd index 9ee6c065..a05b5124 100644 --- a/man/filter_data.Rd +++ b/man/filter_data.Rd @@ -46,8 +46,7 @@ Default: "line". Options: "line", "point", or "area"} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_biomass.Rd b/man/plot_biomass.Rd index c82e9f02..2c829d1d 100644 --- a/man/plot_biomass.Rd +++ b/man/plot_biomass.Rd @@ -34,8 +34,7 @@ Default: "line". Options: "line", "point", or "area"} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. @@ -47,13 +46,16 @@ Options: "year", "area", "fleet", "none"} Default: NULL} \item{ref_line}{A string specifying the type of reference you want to -compare biomass to. The default is `"msy"`, which looks for -`"biomass_msy"` in the `"label"` column of `dat`. The actual -searching in `dat` is case agnostic and will work with either upper- or -lower-case letters but you must use one of the options specified in the -default list to ensure that the label on the figure looks correct -regardless of how it is specified in `dat`. Other possibilities may include -"target", "MSY", and "unfished".} + compare biomass to. The default `"msy"` looks for + `"biomass_msy"` in the `"label"` column of `dat`. The actual + searching in `dat` is case-agnostic and will work with either upper- or + lower-case letters. However, you must use one of the options specified in the + default list to ensure that the label on the figure looks correct + regardless of how it is specified in `dat`. + +Default: "msy" + +Options: Including, but not limited to: "target", "MSY", "unfished"} \item{era}{A string naming the era of data. @@ -61,7 +63,9 @@ Default: "time" Options: "early", "time", "fore" (forecast), or NULL (all data)} -\item{unit_label}{units for biomass} +\item{unit_label}{units for biomass + +Default: "metric tons"} \item{module}{(Optional) A string indicating the module_name found in `dat`. If selecting >1 module, place them in a vector like c("module1", "module2"). diff --git a/man/plot_fishing_mortality.Rd b/man/plot_fishing_mortality.Rd index 29f48ee1..d79642fc 100644 --- a/man/plot_fishing_mortality.Rd +++ b/man/plot_fishing_mortality.Rd @@ -31,8 +31,7 @@ Default: "line". Options: "line", "point", or "area"} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_indices.Rd b/man/plot_indices.Rd index a94017e1..5c44e418 100644 --- a/man/plot_indices.Rd +++ b/man/plot_indices.Rd @@ -28,8 +28,7 @@ in `ref_line` is used to plot a reference line or calculate relative spawning bi Default: ""} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_landings.Rd b/man/plot_landings.Rd index 8ec12f2e..b18e8183 100644 --- a/man/plot_landings.Rd +++ b/man/plot_landings.Rd @@ -37,8 +37,7 @@ Default: "line". Options: "line", "point", or "area"} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_natural_mortality.Rd b/man/plot_natural_mortality.Rd index 1e6ed3fc..2db9b3b0 100644 --- a/man/plot_natural_mortality.Rd +++ b/man/plot_natural_mortality.Rd @@ -23,8 +23,7 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_recruitment.Rd b/man/plot_recruitment.Rd index f0920386..3416c7d1 100644 --- a/man/plot_recruitment.Rd +++ b/man/plot_recruitment.Rd @@ -39,8 +39,7 @@ Default: "time" Options: "early", "time", "fore" (forecast), or NULL (all data)} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/plot_spawning_biomass.Rd b/man/plot_spawning_biomass.Rd index 5d9f1af0..07bc5f28 100644 --- a/man/plot_spawning_biomass.Rd +++ b/man/plot_spawning_biomass.Rd @@ -35,8 +35,7 @@ Default: "line". Options: "line", "point", or "area"} -\item{group}{A string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). +\item{group}{A string of a single column that groups the data. Set group = "none" to summarize data over all indexing values. diff --git a/man/table_landings.Rd b/man/table_landings.Rd index e582f105..8b1b60ae 100644 --- a/man/table_landings.Rd +++ b/man/table_landings.Rd @@ -24,7 +24,9 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{unit_label}{Abbreviated units of landings} +\item{unit_label}{Abbreviated units of landings + +Default: "mt"} \item{era}{A string naming the era of data. @@ -36,11 +38,19 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} Default: `FALSE`} -\item{group}{A string identifying the indexing variable of the data. If you -want to just summarize the data across all factors, set group = "none".} +\item{group}{A string of a single column that groups the data. + +Set group = "none" to summarize data over all indexing values. + +Default: NULL +Options: "year", "area", "fleet", "none"} \item{method}{A string describing the method of summarizing data when group -is set to "none". Options are "sum" or "mean". Default is "sum".} +is set to "none". + +Default: "sum" + +Options: "sum" or "mean"} \item{module}{(Optional) A string indicating the module_name found in `dat`. If selecting >1 module, place them in a vector like c("module1", "module2"). @@ -53,7 +63,9 @@ module_name in the console. @seealso [filter_data()]} \item{label}{The label that will be chosen from the input file. If unspecified, the function will search the "label" column and use the first matching label in this ordered list: "landings_weight", "landings_numbers", "landings_expected", -"landings_predicted", "landings".} +"landings_predicted", "landings". + +Default: NULL} \item{make_rda}{A logical value indicating whether to save the object and make an automated caption and alternative text in the form of an `rda` object. If TRUE, @@ -62,7 +74,9 @@ the rda will be exported to the folder indicated in the argument "figures_dir". Default: `FALSE`.} \item{tables_dir}{The location of the folder containing the generated table -rda files ("tables") that will be created if the argument `make_rda` = TRUE.} +rda files ("tables") that will be created if the argument `make_rda` = TRUE. + +Default: the working directory (`getwd()`)} } \value{ A table ready of landed catch by fleet and year. From c4f77c158a7f023499401eb67b5c5cc401236c04 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Wed, 20 May 2026 10:19:40 -0400 Subject: [PATCH 4/8] Batch 4: Update documentation for more functions with defaults and options, as per https://github.com/nmfs-ost/stockplotr/issues/256 --- R/plot_abundance_at_age.R | 30 ++++++++++++++++----- R/plot_catch_comp.R | 22 ++++++++------- R/table_bnc.R | 3 ++- R/utils_rda.R | 52 ++++++++++++++++++++++++++++++++---- man/create_rda.Rd | 23 +++++++++++----- man/export_rda.Rd | 26 +++++++++++++----- man/extract_caps_alttext.Rd | 12 ++++++--- man/plot_abundance_at_age.Rd | 28 +++++++++++++------ man/plot_biomass_at_age.Rd | 24 ++++++++++++----- man/plot_catch_comp.Rd | 42 ++++++++++++++++------------- 10 files changed, 191 insertions(+), 71 deletions(-) diff --git a/R/plot_abundance_at_age.R b/R/plot_abundance_at_age.R index 91714d58..526792f8 100644 --- a/R/plot_abundance_at_age.R +++ b/R/plot_abundance_at_age.R @@ -1,26 +1,44 @@ #' Plot Abundance (or Numbers) at Age (AAA or NAA) #' #' @param dat A data frame returned from \link[stockplotr]{convert_output} -#' @param facet a string or vector of strings of column(s) that -#' groups the data (e.g. "fleet", "sex", "area", etc.). Set facet = "none" to -#' summarize the data in a single plot. +#' @param facet a string or vector of strings of a column that facets the data. +#' Set facet = "none" to summarize the data in a single plot. +#' +#' Default: NULL +#' +#' Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", +#' NULL +#' #' @param unit_label units for abundance +#' +#' Default: "fish" +#' #' @param scale_amount A number describing how much to scale down the abundance at #' age. Please choose a value ranging from 1-1,000,000,000 (one billion) in orders #' of magnitude (e.g., 1, 10, 100, 1000, etc.). For example, scale_amount = 100 #' would scale down a value from 500,000 --> 5,000 and would report abundance in #' hundreds of fish (if "fish" was the unit_label). This scale will be reflected -#' in the legend label if proportional is set to FALSE. The default is 1,000. +#' in the legend label if proportional is set to FALSE. +#' +#' Default: "1000" +#' #' @param proportional Set size of points relative to z when TRUE, point #' size are relative to one another while when set to FALSE, point size #' is relative to z +#' +#' Default: `TRUE` +#' #' @param make_rda TRUE/FALSE; indicate whether to produce an .rda file containing #' a list with the figure/table, caption, and alternative text (if figure). If TRUE, #' the .rda will be exported to the folder indicated in the argument "rda_dir". -#' Default is FALSE. +#' +#' Default: `FALSE` +#' #' @param figures_dir The location of the folder containing the generated .rda files #' ("rda_files") that will be created if the argument `make_rda` = TRUE. -#' Default is the working directory. +#' +#' Default: the working directory (`getwd()`) +#' #' @returns A plot showing total abundance (or numbers) at age. #' #' @details The input is from an assessment model output file diff --git a/R/plot_catch_comp.R b/R/plot_catch_comp.R index 560aec60..f679080b 100644 --- a/R/plot_catch_comp.R +++ b/R/plot_catch_comp.R @@ -2,22 +2,24 @@ #' #' @inheritParams plot_abundance_at_age #' @param unit_label indicate the name of the units of catch as to label the axis +#' +#' Default: "mt" +#' #' @param scale_amount A number describing how much to scale down the catch at #' age. Please choose a value ranging from 1-1,000,000,000 (one billion) in orders #' of magnitude (e.g., 1, 10, 100, 1000, etc.). For example, scale_amount = 100 #' would scale down a value from 500,000 --> 5,000 and would report catch in #' hundreds of the 'unit_label'. This scale will be reflected -#' in the legend label if proportional is set to FALSE. The default is 1. -#' @param era a string naming the era of data such as historical ("early"), current ("time"), or -#' projected ("fore") data if filtering should occur. Default is set to "time" which is -#' the current time. To plot all data, set era to NULL. -#' @param interactive TRUE/FALSE; indicate whether the environment in which the -#' function is operating is interactive. This bypasses some options for -#' filtering when preparing data for the plot. Default is FALSE. -#' @param module (Optional) A string indicating the linked module_name associated -#' with the label for the plot if known. Default is NULL. By default, the function -#' will select the most relevant module if more than 1 exists. +#' in the legend label if proportional is set to FALSE. +#' +#' Default: "1" +#' +#' @param era A string naming the era of data. +#' +#' Default: "time" #' +#' Options: "early", "time", "fore" (forecast), or NULL (all data) +#' #' @returns A plot showing catch or landings composition. #' #' @details This plot is made only when catch or landings are explicitly named diff --git a/R/table_bnc.R b/R/table_bnc.R index a6775e44..3f0ee7db 100644 --- a/R/table_bnc.R +++ b/R/table_bnc.R @@ -40,7 +40,8 @@ # biomass_label <- glue::glue("Biomass ({biomass_unit_label})") # catch_label <- glue::glue("Catch ({catch_unit_label})") # sb_label <- glue::glue("Spawning biomass ({sb_unit_label})") - +# TODO: Update documentation to match formatting of other functions, with +# lines for Default and Options # # create plot-specific variables to use throughout fxn for naming and IDing # topic_label <- "bnc" diff --git a/R/utils_rda.R b/R/utils_rda.R index abe31d1f..66316f3a 100644 --- a/R/utils_rda.R +++ b/R/utils_rda.R @@ -197,13 +197,29 @@ insert_kqs <- function(...) { #' @param dat Data frame containing data which will fill in captions and #' alternative text for the object #' @param dir Directory to where the rda will be saved -#' @param year Default to current year -#' @param ref_line Reference line value such as "msy", "target" or "unfished" -#' @param ref_point Reference point value such as "msy", "target" or "unfished" +#' +#' Default: the working directory (`getwd()`) +#' +#' @param year Assessment year +#' +#' Default: the current year +#' +#' @param ref_line Reference line value +#' +#' Default: "msy" +#' +#' Options: Including, but not limited to: "msy", "target", "unfished" +#' #' @param scale_amount A number describing how much to scale down the quantities #' shown on the y axis. For example, scale_amount = 100 would scale down a value #' from 500,000 --> 5,000. This scale will be reflected in the y axis label. +#' +#' Default: "1" +#' #' @param unit_label A string containing a unit label for the y-axis +#' +#' Default: "mt" +#' #' @param table_df The data frame that the table will be made into for purposes #' of exporting a latex formatted table. #' @@ -229,7 +245,6 @@ create_rda <- function( dir = getwd(), year = format(as.POSIXct(Sys.Date(), format = "%YYYY-%mm-%dd"), "%Y"), ref_line = "msy", - ref_point = "msy", # this is not used anywhere scale_amount = 1, unit_label = "mt", table_df = NULL @@ -500,9 +515,17 @@ create_rda <- function( #' @param topic_label A string that describes a figure or table's label. These #' labels are found in the "label" column of the "captions_alt_text.csv" file #' and are used to link the figure or table with its caption/alt text. +#' +#' Default: NULL +#' #' @param fig_or_table A string describing whether the plot is a figure or table. +#' +#' Default: NULL +#' #' @param dir The directory containing the "captions_alt_text.csv" file. #' +#' Default: the working directory (`getwd()`) +#' #' @returns A figure's caption and alternative text, in a list, or a table's caption. #' @seealso [export_rda()], [create_rda()] #' @export @@ -566,19 +589,38 @@ extract_caps_alttext <- function(topic_label = NULL, #' Typically used after stockplotr::extract_caps_alttext(). #' #' @param object The final figure (ggplot) or table (flextable) object. +#' +#' Default: NULL +#' #' @param caps_alttext The object containing a figure's caption and alternative #' text, in a list, or a table's caption, likely generated with #' stockplotr::extract_caps_alttext(). +#' +#' Default: NULL +#' #' @param figures_tables_dir If the user has already created folders containing #' figures and tables ("figures" and "tables"), figures_tables_dir represents #' the location of these folders. Otherwise, these two folders will be created #' automatically, then used to store the exported rda files. +#' +#' Default: NULL +#' #' @param topic_label A string that describes a figure or table's label. These #' labels are found in the "label" column of the "captions_alt_text.csv" file #' and are used to link the figure or table with its caption/alt text. +#' +#' Default: NULL +#' #' @param fig_or_table A string describing whether the plot is a figure or table. +#' +#' Default: NULL +#' +#' Options: "figure", "table" +#' #' @param latex_table The object containing a LaTeX-based table. -#' +#' +#' Default: NULL +#' #' @returns An rda file with a figure's ggplot, caption, and alternative text, or #' a table's gt-based table, caption, and LaTeX-based table. #' @seealso [create_rda()], [extract_caps_alttext()] diff --git a/man/create_rda.Rd b/man/create_rda.Rd index 3e8f13d2..1cefe2fb 100644 --- a/man/create_rda.Rd +++ b/man/create_rda.Rd @@ -12,7 +12,6 @@ create_rda( dir = getwd(), year = format(as.POSIXct(Sys.Date(), format = "\%YYYY-\%mm-\%dd"), "\%Y"), ref_line = "msy", - ref_point = "msy", scale_amount = 1, unit_label = "mt", table_df = NULL @@ -28,19 +27,29 @@ create_rda( \item{dat}{Data frame containing data which will fill in captions and alternative text for the object} -\item{dir}{Directory to where the rda will be saved} +\item{dir}{Directory to where the rda will be saved -\item{year}{Default to current year} +Default: the working directory (`getwd()`)} -\item{ref_line}{Reference line value such as "msy", "target" or "unfished"} +\item{year}{Assessment year -\item{ref_point}{Reference point value such as "msy", "target" or "unfished"} +Default: the current year} + +\item{ref_line}{Reference line value + +Default: "msy" + +Options: Including, but not limited to: "msy", "target", "unfished"} \item{scale_amount}{A number describing how much to scale down the quantities shown on the y axis. For example, scale_amount = 100 would scale down a value -from 500,000 --> 5,000. This scale will be reflected in the y axis label.} +from 500,000 --> 5,000. This scale will be reflected in the y axis label. + +Default: "1"} + +\item{unit_label}{A string containing a unit label for the y-axis -\item{unit_label}{A string containing a unit label for the y-axis} +Default: "mt"} \item{table_df}{The data frame that the table will be made into for purposes of exporting a latex formatted table.} diff --git a/man/export_rda.Rd b/man/export_rda.Rd index 09cce00b..dfcfe748 100644 --- a/man/export_rda.Rd +++ b/man/export_rda.Rd @@ -14,24 +14,38 @@ export_rda( ) } \arguments{ -\item{object}{The final figure (ggplot) or table (flextable) object.} +\item{object}{The final figure (ggplot) or table (flextable) object. + +Default: NULL} \item{caps_alttext}{The object containing a figure's caption and alternative text, in a list, or a table's caption, likely generated with -stockplotr::extract_caps_alttext().} +stockplotr::extract_caps_alttext(). + +Default: NULL} \item{figures_tables_dir}{If the user has already created folders containing figures and tables ("figures" and "tables"), figures_tables_dir represents the location of these folders. Otherwise, these two folders will be created -automatically, then used to store the exported rda files.} +automatically, then used to store the exported rda files. + +Default: NULL} \item{topic_label}{A string that describes a figure or table's label. These labels are found in the "label" column of the "captions_alt_text.csv" file -and are used to link the figure or table with its caption/alt text.} +and are used to link the figure or table with its caption/alt text. + +Default: NULL} + +\item{fig_or_table}{A string describing whether the plot is a figure or table. + +Default: NULL + +Options: "figure", "table"} -\item{fig_or_table}{A string describing whether the plot is a figure or table.} +\item{latex_table}{The object containing a LaTeX-based table. -\item{latex_table}{The object containing a LaTeX-based table.} +Default: NULL} } \value{ An rda file with a figure's ggplot, caption, and alternative text, or diff --git a/man/extract_caps_alttext.Rd b/man/extract_caps_alttext.Rd index 278ff0f4..9a3c5420 100644 --- a/man/extract_caps_alttext.Rd +++ b/man/extract_caps_alttext.Rd @@ -9,11 +9,17 @@ extract_caps_alttext(topic_label = NULL, fig_or_table = NULL, dir = getwd()) \arguments{ \item{topic_label}{A string that describes a figure or table's label. These labels are found in the "label" column of the "captions_alt_text.csv" file -and are used to link the figure or table with its caption/alt text.} +and are used to link the figure or table with its caption/alt text. -\item{fig_or_table}{A string describing whether the plot is a figure or table.} +Default: NULL} -\item{dir}{The directory containing the "captions_alt_text.csv" file.} +\item{fig_or_table}{A string describing whether the plot is a figure or table. + +Default: NULL} + +\item{dir}{The directory containing the "captions_alt_text.csv" file. + +Default: the working directory (`getwd()`)} } \value{ A figure's caption and alternative text, in a list, or a table's caption. diff --git a/man/plot_abundance_at_age.Rd b/man/plot_abundance_at_age.Rd index f28641c0..1431ef19 100644 --- a/man/plot_abundance_at_age.Rd +++ b/man/plot_abundance_at_age.Rd @@ -17,31 +17,43 @@ plot_abundance_at_age( \arguments{ \item{dat}{A data frame returned from \link[stockplotr]{convert_output}} -\item{facet}{a string or vector of strings of column(s) that -groups the data (e.g. "fleet", "sex", "area", etc.). Set facet = "none" to -summarize the data in a single plot.} +\item{facet}{a string or vector of strings of a column that facets the data. +Set facet = "none" to summarize the data in a single plot. -\item{unit_label}{units for abundance} +Default: NULL + +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", +NULL} + +\item{unit_label}{units for abundance + +Default: "fish"} \item{scale_amount}{A number describing how much to scale down the abundance at age. Please choose a value ranging from 1-1,000,000,000 (one billion) in orders of magnitude (e.g., 1, 10, 100, 1000, etc.). For example, scale_amount = 100 would scale down a value from 500,000 --> 5,000 and would report abundance in hundreds of fish (if "fish" was the unit_label). This scale will be reflected -in the legend label if proportional is set to FALSE. The default is 1,000.} +in the legend label if proportional is set to FALSE. + +Default: "1000"} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size -is relative to z} +is relative to z + +Default: `TRUE`} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, the .rda will be exported to the folder indicated in the argument "rda_dir". -Default is FALSE.} + +Default: `FALSE`} \item{figures_dir}{The location of the folder containing the generated .rda files ("rda_files") that will be created if the argument `make_rda` = TRUE. -Default is the working directory.} + +Default: the working directory (`getwd()`)} } \value{ A plot showing total abundance (or numbers) at age. diff --git a/man/plot_biomass_at_age.Rd b/man/plot_biomass_at_age.Rd index a7f1db6a..82a39820 100644 --- a/man/plot_biomass_at_age.Rd +++ b/man/plot_biomass_at_age.Rd @@ -18,11 +18,17 @@ plot_biomass_at_age( \arguments{ \item{dat}{A data frame returned from \link[stockplotr]{convert_output}} -\item{facet}{a string or vector of strings of column(s) that -groups the data (e.g. "fleet", "sex", "area", etc.). Set facet = "none" to -summarize the data in a single plot.} +\item{facet}{a string or vector of strings of a column that facets the data. +Set facet = "none" to summarize the data in a single plot. -\item{unit_label}{units for abundance} +Default: NULL + +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", +NULL} + +\item{unit_label}{units for abundance + +Default: "fish"} \item{scale_amount}{A number describing how much to scale down the biomass at age. For example, scale_amount = 100 would scale down a value @@ -33,7 +39,9 @@ Default: "1000"} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size -is relative to z} +is relative to z + +Default: `TRUE`} \item{interactive}{TRUE/FALSE; indicate whether the environment in which the function is operating is interactive. This bypasses some options for @@ -44,11 +52,13 @@ Default: `FALSE`} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, the .rda will be exported to the folder indicated in the argument "rda_dir". -Default is FALSE.} + +Default: `FALSE`} \item{figures_dir}{The location of the folder containing the generated .rda files ("rda_files") that will be created if the argument `make_rda` = TRUE. -Default is the working directory.} + +Default: the working directory (`getwd()`)} } \value{ A plot showing total biomass at age. diff --git a/man/plot_catch_comp.Rd b/man/plot_catch_comp.Rd index 800cdc2d..1bd34e9e 100644 --- a/man/plot_catch_comp.Rd +++ b/man/plot_catch_comp.Rd @@ -20,43 +20,49 @@ plot_catch_comp( \arguments{ \item{dat}{A data frame returned from \link[stockplotr]{convert_output}} -\item{facet}{a string or vector of strings of column(s) that -groups the data (e.g. "fleet", "sex", "area", etc.). Set facet = "none" to -summarize the data in a single plot.} +\item{facet}{a string or vector of strings of a column that facets the data. +Set facet = "none" to summarize the data in a single plot. -\item{era}{a string naming the era of data such as historical ("early"), current ("time"), or -projected ("fore") data if filtering should occur. Default is set to "time" which is -the current time. To plot all data, set era to NULL.} +Default: NULL -\item{unit_label}{indicate the name of the units of catch as to label the axis} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", +NULL} + +\item{era}{A string naming the era of data. + +Default: "time" + +Options: "early", "time", "fore" (forecast), or NULL (all data)} + +\item{unit_label}{indicate the name of the units of catch as to label the axis + +Default: "mt"} \item{scale_amount}{A number describing how much to scale down the catch at age. Please choose a value ranging from 1-1,000,000,000 (one billion) in orders of magnitude (e.g., 1, 10, 100, 1000, etc.). For example, scale_amount = 100 would scale down a value from 500,000 --> 5,000 and would report catch in hundreds of the 'unit_label'. This scale will be reflected -in the legend label if proportional is set to FALSE. The default is 1.} +in the legend label if proportional is set to FALSE. + +Default: "1"} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size -is relative to z} - -\item{interactive}{TRUE/FALSE; indicate whether the environment in which the -function is operating is interactive. This bypasses some options for -filtering when preparing data for the plot. Default is FALSE.} +is relative to z -\item{module}{(Optional) A string indicating the linked module_name associated -with the label for the plot if known. Default is NULL. By default, the function -will select the most relevant module if more than 1 exists.} +Default: `TRUE`} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, the .rda will be exported to the folder indicated in the argument "rda_dir". -Default is FALSE.} + +Default: `FALSE`} \item{figures_dir}{The location of the folder containing the generated .rda files ("rda_files") that will be created if the argument `make_rda` = TRUE. -Default is the working directory.} + +Default: the working directory (`getwd()`)} } \value{ A plot showing catch or landings composition. From b05b6d5011212bd7beba7ba280db747c0aebe7fc Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Wed, 20 May 2026 10:51:06 -0400 Subject: [PATCH 5/8] Sub "mt" for "metric tons" to ensure consistency in labelling --- R/plot_biomass.R | 4 +-- R/plot_landings.R | 2 +- R/plot_spawning_biomass.R | 6 ++-- R/save_all_plots.R | 63 ++++++++++++++++++++++++++++++++ man/save_all_plots.Rd | 76 +++++++++++++++++++++++++++++---------- 5 files changed, 127 insertions(+), 24 deletions(-) diff --git a/R/plot_biomass.R b/R/plot_biomass.R index 6a9ddd6b..c3ba3bb4 100644 --- a/R/plot_biomass.R +++ b/R/plot_biomass.R @@ -3,7 +3,7 @@ #' @inheritParams plot_spawning_biomass #' @param unit_label units for biomass #' -#' Default: "metric tons" +#' Default: "mt" #' @param ref_line A string specifying the type of reference you want to #' compare biomass to. The default `"msy"` looks for #' `"biomass_msy"` in the `"label"` column of `dat`. The actual @@ -48,7 +48,7 @@ plot_biomass <- function( facet = NULL, ref_line = "msy", era = NULL, - unit_label = "metric tons", + unit_label = "mt", module = NULL, scale_amount = 1, relative = FALSE, diff --git a/R/plot_landings.R b/R/plot_landings.R index d1967521..b2d20da4 100644 --- a/R/plot_landings.R +++ b/R/plot_landings.R @@ -30,7 +30,7 @@ #' ) plot_landings <- function( dat, - unit_label = "metric tons", + unit_label = "mt", geom = "line", group = NULL, facet = NULL, diff --git a/R/plot_spawning_biomass.R b/R/plot_spawning_biomass.R index dc87b911..520e3bc1 100644 --- a/R/plot_spawning_biomass.R +++ b/R/plot_spawning_biomass.R @@ -35,10 +35,10 @@ #' If the reference point is not found in the data, set ref_line = c("name" = value). #' @param unit_label A string specifying spawning biomass unit. #' -#' Default: "metric tons" +#' Default: "mt" #' @param lbs A logical value indicating whether to convert the y-axis values from #' kilograms to pounds. The default units match the default in the -#' unit_label argument - 'metric tons'. +#' unit_label argument - 'mt'. #' #' Default: `FALSE` #' @param module (Optional) A string indicating the module_name found in `dat`. @@ -108,7 +108,7 @@ plot_spawning_biomass <- function( group = NULL, facet = NULL, ref_line = "msy", - unit_label = "metric tons", + unit_label = "mt", era = NULL, lbs = FALSE, module = NULL, diff --git a/R/save_all_plots.R b/R/save_all_plots.R index b2119135..6f1fe077 100644 --- a/R/save_all_plots.R +++ b/R/save_all_plots.R @@ -7,9 +7,18 @@ #' the recruitment quantities shown on the y axis. For example, #' recruitment_scale_amount = 100 would scale down a value from 500,000 --> #' 5,000. This scale will be reflected in the y axis label. +#' +#' Default: "1" +#' #' @param recruitment_unit_label Units for recruitment +#' +#' Default: "mt" +#' #' @param figures_tables_dir The location of the folder containing #' figures and tables ("figures" and "tables"). +#' +#' Default: the working directory (`getwd()`) +#' #' @param ref_line A string specifying the type of reference you want to #' compare biomass to. The default is `"msy"`, which looks for #' `"biomass_msy"` in the `"label"` column of `dat`. The actual @@ -19,28 +28,82 @@ #' regardless of how it is specified in `dat`. Other possibilities may include #' "target", "MSY", and "unfished". When the reference cannot be found, #' indicate the reference line in the form c("label" = value). +#' +#' Default: "msy" +#' +#' Options: Including, but not limited to: "target", "MSY", "unfished" +#' #' @param biomass_scale_amount A number describing how much to scale down the #' biomass quantities shown on the y axis. See `recruitment_scale_amount`. +#' +#' Default: "1" +#' #' @param landings_unit_label Units for landings +#' +#' Default: "mt" +#' #' @param biomass_unit_label Units for biomass +#' +#' Default: "mt" +#' #' @param spawning_biomass_label Units for spawning biomass +#' +#' Default: "mt" +#' #' @param spawning_biomass_scale_amount A number describing how much to scale down the #' spawning biomass quantities shown on the y axis. See `recruitment_scale_amount`. +#' +#' Default: "1" +#' #' @param ref_line_sb Identical definition as `ref_line`, but this argument is #' applied to plot_spawning_biomass. +#' +#' Default: "msy" +#' +#' Options: Including, but not limited to: "target", "MSY", "unfished" +#' #' @param abundance_at_age_scale_amount A number describing how much to scale down the #' abundance quantities shown via bubble size. See `recruitment_scale_amount`. +#' +#' Default: "1" +#' #' @param abundance_at_age_unit_label Abbreviated units for abundance at age +#' +#' Default: "fish" +#' #' @param biomass_at_age_scale_amount A number describing how much to scale down the #' biomass quantities shown via bubble size. See `recruitment_scale_amount`. +#' +#' Default: "1" +#' #' @param biomass_at_age_unit_label Abbreviated units for biomass at age +#' +#' Default: "mt" +#' #' @param indices_unit_label Units for index of abundance/CPUE +#' +#' Default: "" +#' #' @param biomass_unit_label Abbreviated units for biomass +#' +#' Default: "mt" +#' #' @param catch_unit_label Abbreviated units for catch +#' +#' Default: "mt" +#' #' @param catch_scale_amount A number describing how much to scale down the #' catch quantities shown via bubble size. See `recruitment_scale_amount`. +#' +#' Default: "1" +#' #' @param landings_unit_label Units for landings +#' +#' Default: "mt" +#' #' @param proportional T/F to scale size of bubble plots +#' +#' Default: `TRUE` #' #' @returns Rda files for each figure/table. #' diff --git a/man/save_all_plots.Rd b/man/save_all_plots.Rd index 27b18a22..17825b26 100644 --- a/man/save_all_plots.Rd +++ b/man/save_all_plots.Rd @@ -35,26 +35,34 @@ returned from \link[stockplotr]{convert_output}. If inputting a list of tibbles, the first tibble's reference point defined in `ref_line` is used to plot a reference line or calculate relative spawning biomass.} -\item{recruitment_unit_label}{Units for recruitment} +\item{recruitment_unit_label}{Units for recruitment + +Default: "mt"} \item{recruitment_scale_amount}{A number describing how much to scale down the recruitment quantities shown on the y axis. For example, recruitment_scale_amount = 100 would scale down a value from 500,000 --> -5,000. This scale will be reflected in the y axis label.} +5,000. This scale will be reflected in the y axis label. + +Default: "1"} \item{relative}{A logical value specifying to set y-axis values relative to the ref_line value. Default: `FALSE`} -\item{proportional}{T/F to scale size of bubble plots} +\item{proportional}{T/F to scale size of bubble plots + +Default: `TRUE`} \item{interactive}{A logical value indicating if the environment is interactive. Default: `FALSE`} \item{figures_tables_dir}{The location of the folder containing -figures and tables ("figures" and "tables").} +figures and tables ("figures" and "tables"). + +Default: the working directory (`getwd()`)} \item{ref_line}{A string specifying the type of reference you want to compare biomass to. The default is `"msy"`, which looks for @@ -64,39 +72,71 @@ lower-case letters but you must use one of the options specified in the default list to ensure that the label on the figure looks correct regardless of how it is specified in `dat`. Other possibilities may include "target", "MSY", and "unfished". When the reference cannot be found, -indicate the reference line in the form c("label" = value).} +indicate the reference line in the form c("label" = value). + +Default: "msy" + +Options: Including, but not limited to: "target", "MSY", "unfished"} \item{biomass_scale_amount}{A number describing how much to scale down the -biomass quantities shown on the y axis. See `recruitment_scale_amount`.} +biomass quantities shown on the y axis. See `recruitment_scale_amount`. + +Default: "1"} + +\item{landings_unit_label}{Units for landings -\item{landings_unit_label}{Units for landings} +Default: "mt"} -\item{spawning_biomass_label}{Units for spawning biomass} +\item{spawning_biomass_label}{Units for spawning biomass + +Default: "mt"} \item{spawning_biomass_scale_amount}{A number describing how much to scale down the -spawning biomass quantities shown on the y axis. See `recruitment_scale_amount`.} +spawning biomass quantities shown on the y axis. See `recruitment_scale_amount`. + +Default: "1"} \item{ref_line_sb}{Identical definition as `ref_line`, but this argument is -applied to plot_spawning_biomass.} +applied to plot_spawning_biomass. + +Default: "msy" + +Options: Including, but not limited to: "target", "MSY", "unfished"} \item{abundance_at_age_scale_amount}{A number describing how much to scale down the -abundance quantities shown via bubble size. See `recruitment_scale_amount`.} +abundance quantities shown via bubble size. See `recruitment_scale_amount`. + +Default: "1"} -\item{abundance_at_age_unit_label}{Abbreviated units for abundance at age} +\item{abundance_at_age_unit_label}{Abbreviated units for abundance at age + +Default: "fish"} \item{biomass_at_age_scale_amount}{A number describing how much to scale down the -biomass quantities shown via bubble size. See `recruitment_scale_amount`.} +biomass quantities shown via bubble size. See `recruitment_scale_amount`. + +Default: "1"} -\item{biomass_at_age_unit_label}{Abbreviated units for biomass at age} +\item{biomass_at_age_unit_label}{Abbreviated units for biomass at age -\item{indices_unit_label}{Units for index of abundance/CPUE} +Default: "mt"} -\item{biomass_unit_label}{Abbreviated units for biomass} +\item{indices_unit_label}{Units for index of abundance/CPUE -\item{catch_unit_label}{Abbreviated units for catch} +Default: ""} + +\item{biomass_unit_label}{Abbreviated units for biomass + +Default: "mt"} + +\item{catch_unit_label}{Abbreviated units for catch + +Default: "mt"} \item{catch_scale_amount}{A number describing how much to scale down the -catch quantities shown via bubble size. See `recruitment_scale_amount`.} +catch quantities shown via bubble size. See `recruitment_scale_amount`. + +Default: "1"} } \value{ Rda files for each figure/table. From b27cd8e5daa408ef6858539a8e7255261375642d Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Wed, 20 May 2026 11:09:03 -0400 Subject: [PATCH 6/8] Make "group" and "interactive" params consistent across functions; update documentation --- R/plot_biomass_at_age.R | 4 ++-- R/plot_spawning_biomass.R | 3 ++- R/process_data.R | 2 +- R/table_landings.R | 2 +- R/utils_plot.R | 6 ++++-- man/filter_data.Rd | 2 +- man/plot_biomass.Rd | 6 +++--- man/plot_biomass_at_age.Rd | 4 ++-- man/plot_error.Rd | 7 ++++--- man/plot_fishing_mortality.Rd | 2 +- man/plot_indices.Rd | 2 +- man/plot_landings.Rd | 8 ++++---- man/plot_natural_mortality.Rd | 2 +- man/plot_obsvpred.Rd | 7 ++++--- man/plot_recruitment.Rd | 2 +- man/plot_spawning_biomass.Rd | 8 ++++---- man/plot_timeseries.Rd | 7 ++++--- man/process_data.Rd | 2 +- man/process_table.Rd | 2 +- man/reference_line.Rd | 2 +- man/table_landings.Rd | 2 +- 21 files changed, 44 insertions(+), 38 deletions(-) diff --git a/R/plot_biomass_at_age.R b/R/plot_biomass_at_age.R index 7766eb67..dd540119 100644 --- a/R/plot_biomass_at_age.R +++ b/R/plot_biomass_at_age.R @@ -12,7 +12,7 @@ #' function is operating is interactive. This bypasses some options for #' filtering when preparing data for the plot. #' -#' Default: `FALSE` +#' Default: `TRUE` #' #' @returns A plot showing total biomass at age. #' @@ -45,7 +45,7 @@ plot_biomass_at_age <- function( unit_label = "mt", scale_amount = 1000, proportional = TRUE, - interactive = FALSE, + interactive = TRUE, make_rda = FALSE, figures_dir = getwd() ) { diff --git a/R/plot_spawning_biomass.R b/R/plot_spawning_biomass.R index 520e3bc1..e07f1cbf 100644 --- a/R/plot_spawning_biomass.R +++ b/R/plot_spawning_biomass.R @@ -18,7 +18,8 @@ #' Set group = "none" to summarize data over all indexing values. #' #' Default: NULL -#' Options: "year", "area", "fleet", "none" +#' Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL +#' #' @param facet A string or vector of strings of a column name. #' #' Default: NULL diff --git a/R/process_data.R b/R/process_data.R index 0d244bdb..b4499283 100644 --- a/R/process_data.R +++ b/R/process_data.R @@ -13,7 +13,7 @@ #' #' Default: NULL #' -#' Options: Including, but not limited to: "none", NULL +#' Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL #' @param facet A string or vector of strings identifying the faceting #' variable(s) of the data. #' diff --git a/R/table_landings.R b/R/table_landings.R index 88243214..95570d3c 100644 --- a/R/table_landings.R +++ b/R/table_landings.R @@ -9,7 +9,7 @@ #' Set group = "none" to summarize data over all indexing values. #' #' Default: NULL -#' Options: "year", "area", "fleet", "none" +#' Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL #' @param method A string describing the method of summarizing data when group #' is set to "none". #' diff --git a/R/utils_plot.R b/R/utils_plot.R index 007b7cde..e3a3c5f8 100644 --- a/R/utils_plot.R +++ b/R/utils_plot.R @@ -26,10 +26,12 @@ #' of `y`. #' #' Default: NULL -#' @param group a string of a single column that groups the data (e.g. "fleet", -#' "sex", "area", etc.). Currently can only have one level of grouping. +#' @param group a string of a single column that groups the data. +#' Currently can only have one level of grouping. #' #' Default: NULL +#' Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL +#' #' @param facet a string or vector of strings of a column that facets the data #' (e.g. "year", "area", etc.) #' diff --git a/man/filter_data.Rd b/man/filter_data.Rd index a05b5124..824004b3 100644 --- a/man/filter_data.Rd +++ b/man/filter_data.Rd @@ -51,7 +51,7 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. diff --git a/man/plot_biomass.Rd b/man/plot_biomass.Rd index 2c829d1d..f4276339 100644 --- a/man/plot_biomass.Rd +++ b/man/plot_biomass.Rd @@ -11,7 +11,7 @@ plot_biomass( facet = NULL, ref_line = "msy", era = NULL, - unit_label = "metric tons", + unit_label = "mt", module = NULL, scale_amount = 1, relative = FALSE, @@ -39,7 +39,7 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. @@ -65,7 +65,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} \item{unit_label}{units for biomass -Default: "metric tons"} +Default: "mt"} \item{module}{(Optional) A string indicating the module_name found in `dat`. If selecting >1 module, place them in a vector like c("module1", "module2"). diff --git a/man/plot_biomass_at_age.Rd b/man/plot_biomass_at_age.Rd index 82a39820..fbcaa324 100644 --- a/man/plot_biomass_at_age.Rd +++ b/man/plot_biomass_at_age.Rd @@ -10,7 +10,7 @@ plot_biomass_at_age( unit_label = "mt", scale_amount = 1000, proportional = TRUE, - interactive = FALSE, + interactive = TRUE, make_rda = FALSE, figures_dir = getwd() ) @@ -47,7 +47,7 @@ Default: `TRUE`} function is operating is interactive. This bypasses some options for filtering when preparing data for the plot. -Default: `FALSE`} +Default: `TRUE`} \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, diff --git a/man/plot_error.Rd b/man/plot_error.Rd index 58982737..33223fac 100644 --- a/man/plot_error.Rd +++ b/man/plot_error.Rd @@ -36,10 +36,11 @@ Default: "line" Options: "point" and "area"} -\item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping. +\item{group}{a string of a single column that groups the data. +Currently can only have one level of grouping. -Default: NULL} +Default: NULL +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{a string or vector of strings of a column that facets the data (e.g. "year", "area", etc.) diff --git a/man/plot_fishing_mortality.Rd b/man/plot_fishing_mortality.Rd index d79642fc..83ea75e6 100644 --- a/man/plot_fishing_mortality.Rd +++ b/man/plot_fishing_mortality.Rd @@ -36,7 +36,7 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. diff --git a/man/plot_indices.Rd b/man/plot_indices.Rd index 5c44e418..cec8ad08 100644 --- a/man/plot_indices.Rd +++ b/man/plot_indices.Rd @@ -33,7 +33,7 @@ Default: ""} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{a string or vector of strings of a column that facets the data. "fleet" is always added on to any faceting selections diff --git a/man/plot_landings.Rd b/man/plot_landings.Rd index b18e8183..edcb43de 100644 --- a/man/plot_landings.Rd +++ b/man/plot_landings.Rd @@ -6,7 +6,7 @@ \usage{ plot_landings( dat, - unit_label = "metric tons", + unit_label = "mt", geom = "line", group = NULL, facet = NULL, @@ -29,7 +29,7 @@ in `ref_line` is used to plot a reference line or calculate relative spawning bi \item{unit_label}{A string specifying spawning biomass unit. -Default: "metric tons"} +Default: "mt"} \item{geom}{A string stating the geom used for the plot. @@ -42,7 +42,7 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. @@ -50,7 +50,7 @@ Default: NULL} \item{lbs}{A logical value indicating whether to convert the y-axis values from kilograms to pounds. The default units match the default in the -unit_label argument - 'metric tons'. +unit_label argument - 'mt'. Default: `FALSE`} diff --git a/man/plot_natural_mortality.Rd b/man/plot_natural_mortality.Rd index 2db9b3b0..7363a494 100644 --- a/man/plot_natural_mortality.Rd +++ b/man/plot_natural_mortality.Rd @@ -28,7 +28,7 @@ in `ref_line` is used to plot a reference line or calculate relative spawning bi Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. diff --git a/man/plot_obsvpred.Rd b/man/plot_obsvpred.Rd index 7fe89e42..1799d40a 100644 --- a/man/plot_obsvpred.Rd +++ b/man/plot_obsvpred.Rd @@ -53,10 +53,11 @@ Default: "Year"} Default: NULL} -\item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping. +\item{group}{a string of a single column that groups the data. +Currently can only have one level of grouping. -Default: NULL} +Default: NULL +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{a string or vector of strings of a column that facets the data (e.g. "year", "area", etc.) diff --git a/man/plot_recruitment.Rd b/man/plot_recruitment.Rd index 3416c7d1..df79db39 100644 --- a/man/plot_recruitment.Rd +++ b/man/plot_recruitment.Rd @@ -44,7 +44,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. diff --git a/man/plot_spawning_biomass.Rd b/man/plot_spawning_biomass.Rd index 07bc5f28..c5a53c69 100644 --- a/man/plot_spawning_biomass.Rd +++ b/man/plot_spawning_biomass.Rd @@ -10,7 +10,7 @@ plot_spawning_biomass( group = NULL, facet = NULL, ref_line = "msy", - unit_label = "metric tons", + unit_label = "mt", era = NULL, lbs = FALSE, module = NULL, @@ -40,7 +40,7 @@ Options: "line", "point", or "area"} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings of a column name. @@ -55,7 +55,7 @@ If the reference point is not found in the data, set ref_line = c("name" = value \item{unit_label}{A string specifying spawning biomass unit. -Default: "metric tons"} +Default: "mt"} \item{era}{A string naming the era of data. @@ -65,7 +65,7 @@ Options: "early", "time", "fore" (forecast), or NULL (all data)} \item{lbs}{A logical value indicating whether to convert the y-axis values from kilograms to pounds. The default units match the default in the -unit_label argument - 'metric tons'. +unit_label argument - 'mt'. Default: `FALSE`} diff --git a/man/plot_timeseries.Rd b/man/plot_timeseries.Rd index 7d8847f8..a9ef54b5 100644 --- a/man/plot_timeseries.Rd +++ b/man/plot_timeseries.Rd @@ -44,10 +44,11 @@ Default: "Year"} Default: NULL} -\item{group}{a string of a single column that groups the data (e.g. "fleet", -"sex", "area", etc.). Currently can only have one level of grouping. +\item{group}{a string of a single column that groups the data. +Currently can only have one level of grouping. -Default: NULL} +Default: NULL +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{a string or vector of strings of a column that facets the data (e.g. "year", "area", etc.) diff --git a/man/process_data.Rd b/man/process_data.Rd index 9c88a64c..e37c57a1 100644 --- a/man/process_data.Rd +++ b/man/process_data.Rd @@ -17,7 +17,7 @@ variables identified in the data by the function. Default: NULL -Options: Including, but not limited to: "none", NULL} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{facet}{A string or vector of strings identifying the faceting variable(s) of the data. diff --git a/man/process_table.Rd b/man/process_table.Rd index 35dd049b..7ac74872 100644 --- a/man/process_table.Rd +++ b/man/process_table.Rd @@ -17,7 +17,7 @@ variables identified in the data by the function. Default: NULL -Options: Including, but not limited to: "none", NULL} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{method}{A string describing the method of summarizing data when group is set to "none". diff --git a/man/reference_line.Rd b/man/reference_line.Rd index e4f460c5..6f0b390d 100644 --- a/man/reference_line.Rd +++ b/man/reference_line.Rd @@ -24,7 +24,7 @@ Default: 1} \item{lbs}{A logical value indicating whether to convert the y-axis values from kilograms to pounds. The default units match the default in the -unit_label argument - 'metric tons'. +unit_label argument - 'mt'. Default: `FALSE`} } diff --git a/man/table_landings.Rd b/man/table_landings.Rd index 8b1b60ae..26d16271 100644 --- a/man/table_landings.Rd +++ b/man/table_landings.Rd @@ -43,7 +43,7 @@ Default: `FALSE`} Set group = "none" to summarize data over all indexing values. Default: NULL -Options: "year", "area", "fleet", "none"} +Options: Including, but not limited to: "year", "area", "fleet", "sex", "none", NULL} \item{method}{A string describing the method of summarizing data when group is set to "none". From 37b2aef7d531272dd76c1c83ce4dd3f5be1d9629 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Wed, 20 May 2026 11:39:25 -0400 Subject: [PATCH 7/8] Add missing args to plot_catch_comp() --- R/plot_catch_comp.R | 12 ++++++++++++ man/plot_catch_comp.Rd | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/R/plot_catch_comp.R b/R/plot_catch_comp.R index f679080b..8ad54f6b 100644 --- a/R/plot_catch_comp.R +++ b/R/plot_catch_comp.R @@ -20,6 +20,18 @@ #' #' Options: "early", "time", "fore" (forecast), or NULL (all data) #' +#' @param interactive A logical value indicating if the environment is interactive. +#' +#' Default: `FALSE` +#' +#' @param module (Optional) A string indicating the module_name found in `dat`. +#' If selecting >1 module, place them in a vector like c("module1", "module2"). +#' +#' Default: NULL +#' +#' If the interactive and >1 module_name is found, user will select the +#' module_name in the console. @seealso [filter_data()] +#' #' @returns A plot showing catch or landings composition. #' #' @details This plot is made only when catch or landings are explicitly named diff --git a/man/plot_catch_comp.Rd b/man/plot_catch_comp.Rd index 1bd34e9e..1e0bf4d5 100644 --- a/man/plot_catch_comp.Rd +++ b/man/plot_catch_comp.Rd @@ -53,6 +53,18 @@ is relative to z Default: `TRUE`} +\item{interactive}{A logical value indicating if the environment is interactive. + +Default: `FALSE`} + +\item{module}{(Optional) A string indicating the module_name found in `dat`. +If selecting >1 module, place them in a vector like c("module1", "module2"). + +Default: NULL + +If the interactive and >1 module_name is found, user will select the +module_name in the console. @seealso [filter_data()]} + \item{make_rda}{TRUE/FALSE; indicate whether to produce an .rda file containing a list with the figure/table, caption, and alternative text (if figure). If TRUE, the .rda will be exported to the folder indicated in the argument "rda_dir". From dfeee5422941ec3df132101943fe83c43e57fbad Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Thu, 21 May 2026 10:24:56 -0400 Subject: [PATCH 8/8] Make defaults in documentation numeric, if appropriate --- R/plot_abundance_at_age.R | 2 +- R/plot_biomass_at_age.R | 2 +- R/plot_catch_comp.R | 2 +- R/save_all_plots.R | 12 ++++++------ R/utils_rda.R | 2 +- man/create_rda.Rd | 2 +- man/plot_abundance_at_age.Rd | 2 +- man/plot_biomass_at_age.Rd | 2 +- man/plot_catch_comp.Rd | 2 +- man/save_all_plots.Rd | 12 ++++++------ 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/R/plot_abundance_at_age.R b/R/plot_abundance_at_age.R index 526792f8..2c38be90 100644 --- a/R/plot_abundance_at_age.R +++ b/R/plot_abundance_at_age.R @@ -20,7 +20,7 @@ #' hundreds of fish (if "fish" was the unit_label). This scale will be reflected #' in the legend label if proportional is set to FALSE. #' -#' Default: "1000" +#' Default: 1,000 #' #' @param proportional Set size of points relative to z when TRUE, point #' size are relative to one another while when set to FALSE, point size diff --git a/R/plot_biomass_at_age.R b/R/plot_biomass_at_age.R index dd540119..c0933bf5 100644 --- a/R/plot_biomass_at_age.R +++ b/R/plot_biomass_at_age.R @@ -6,7 +6,7 @@ #' from 500,000 --> 5,000. This scale will be reflected in the legend label if #' proportion is set to FALSE. #' -#' Default: "1000" +#' Default: 1,000 #' #' @param interactive TRUE/FALSE; indicate whether the environment in which the #' function is operating is interactive. This bypasses some options for diff --git a/R/plot_catch_comp.R b/R/plot_catch_comp.R index 8ad54f6b..0a900e48 100644 --- a/R/plot_catch_comp.R +++ b/R/plot_catch_comp.R @@ -12,7 +12,7 @@ #' hundreds of the 'unit_label'. This scale will be reflected #' in the legend label if proportional is set to FALSE. #' -#' Default: "1" +#' Default: 1 #' #' @param era A string naming the era of data. #' diff --git a/R/save_all_plots.R b/R/save_all_plots.R index 6f1fe077..10249c6e 100644 --- a/R/save_all_plots.R +++ b/R/save_all_plots.R @@ -8,7 +8,7 @@ #' recruitment_scale_amount = 100 would scale down a value from 500,000 --> #' 5,000. This scale will be reflected in the y axis label. #' -#' Default: "1" +#' Default: 1 #' #' @param recruitment_unit_label Units for recruitment #' @@ -36,7 +36,7 @@ #' @param biomass_scale_amount A number describing how much to scale down the #' biomass quantities shown on the y axis. See `recruitment_scale_amount`. #' -#' Default: "1" +#' Default: 1 #' #' @param landings_unit_label Units for landings #' @@ -53,7 +53,7 @@ #' @param spawning_biomass_scale_amount A number describing how much to scale down the #' spawning biomass quantities shown on the y axis. See `recruitment_scale_amount`. #' -#' Default: "1" +#' Default: 1 #' #' @param ref_line_sb Identical definition as `ref_line`, but this argument is #' applied to plot_spawning_biomass. @@ -65,7 +65,7 @@ #' @param abundance_at_age_scale_amount A number describing how much to scale down the #' abundance quantities shown via bubble size. See `recruitment_scale_amount`. #' -#' Default: "1" +#' Default: 1 #' #' @param abundance_at_age_unit_label Abbreviated units for abundance at age #' @@ -74,7 +74,7 @@ #' @param biomass_at_age_scale_amount A number describing how much to scale down the #' biomass quantities shown via bubble size. See `recruitment_scale_amount`. #' -#' Default: "1" +#' Default: 1 #' #' @param biomass_at_age_unit_label Abbreviated units for biomass at age #' @@ -95,7 +95,7 @@ #' @param catch_scale_amount A number describing how much to scale down the #' catch quantities shown via bubble size. See `recruitment_scale_amount`. #' -#' Default: "1" +#' Default: 1 #' #' @param landings_unit_label Units for landings #' diff --git a/R/utils_rda.R b/R/utils_rda.R index 66316f3a..5072debb 100644 --- a/R/utils_rda.R +++ b/R/utils_rda.R @@ -214,7 +214,7 @@ insert_kqs <- function(...) { #' shown on the y axis. For example, scale_amount = 100 would scale down a value #' from 500,000 --> 5,000. This scale will be reflected in the y axis label. #' -#' Default: "1" +#' Default: 1 #' #' @param unit_label A string containing a unit label for the y-axis #' diff --git a/man/create_rda.Rd b/man/create_rda.Rd index 1cefe2fb..3ca141b8 100644 --- a/man/create_rda.Rd +++ b/man/create_rda.Rd @@ -45,7 +45,7 @@ Options: Including, but not limited to: "msy", "target", "unfished"} shown on the y axis. For example, scale_amount = 100 would scale down a value from 500,000 --> 5,000. This scale will be reflected in the y axis label. -Default: "1"} +Default: 1} \item{unit_label}{A string containing a unit label for the y-axis diff --git a/man/plot_abundance_at_age.Rd b/man/plot_abundance_at_age.Rd index 1431ef19..b3b56c6e 100644 --- a/man/plot_abundance_at_age.Rd +++ b/man/plot_abundance_at_age.Rd @@ -36,7 +36,7 @@ would scale down a value from 500,000 --> 5,000 and would report abundance in hundreds of fish (if "fish" was the unit_label). This scale will be reflected in the legend label if proportional is set to FALSE. -Default: "1000"} +Default: 1,000} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size diff --git a/man/plot_biomass_at_age.Rd b/man/plot_biomass_at_age.Rd index fbcaa324..854e979e 100644 --- a/man/plot_biomass_at_age.Rd +++ b/man/plot_biomass_at_age.Rd @@ -35,7 +35,7 @@ age. For example, scale_amount = 100 would scale down a value from 500,000 --> 5,000. This scale will be reflected in the legend label if proportion is set to FALSE. -Default: "1000"} +Default: 1,000} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size diff --git a/man/plot_catch_comp.Rd b/man/plot_catch_comp.Rd index 1e0bf4d5..5c22dc18 100644 --- a/man/plot_catch_comp.Rd +++ b/man/plot_catch_comp.Rd @@ -45,7 +45,7 @@ would scale down a value from 500,000 --> 5,000 and would report catch in hundreds of the 'unit_label'. This scale will be reflected in the legend label if proportional is set to FALSE. -Default: "1"} +Default: 1} \item{proportional}{Set size of points relative to z when TRUE, point size are relative to one another while when set to FALSE, point size diff --git a/man/save_all_plots.Rd b/man/save_all_plots.Rd index 17825b26..45bc0e8a 100644 --- a/man/save_all_plots.Rd +++ b/man/save_all_plots.Rd @@ -44,7 +44,7 @@ the recruitment quantities shown on the y axis. For example, recruitment_scale_amount = 100 would scale down a value from 500,000 --> 5,000. This scale will be reflected in the y axis label. -Default: "1"} +Default: 1} \item{relative}{A logical value specifying to set y-axis values relative to the ref_line value. @@ -81,7 +81,7 @@ Options: Including, but not limited to: "target", "MSY", "unfished"} \item{biomass_scale_amount}{A number describing how much to scale down the biomass quantities shown on the y axis. See `recruitment_scale_amount`. -Default: "1"} +Default: 1} \item{landings_unit_label}{Units for landings @@ -94,7 +94,7 @@ Default: "mt"} \item{spawning_biomass_scale_amount}{A number describing how much to scale down the spawning biomass quantities shown on the y axis. See `recruitment_scale_amount`. -Default: "1"} +Default: 1} \item{ref_line_sb}{Identical definition as `ref_line`, but this argument is applied to plot_spawning_biomass. @@ -106,7 +106,7 @@ Options: Including, but not limited to: "target", "MSY", "unfished"} \item{abundance_at_age_scale_amount}{A number describing how much to scale down the abundance quantities shown via bubble size. See `recruitment_scale_amount`. -Default: "1"} +Default: 1} \item{abundance_at_age_unit_label}{Abbreviated units for abundance at age @@ -115,7 +115,7 @@ Default: "fish"} \item{biomass_at_age_scale_amount}{A number describing how much to scale down the biomass quantities shown via bubble size. See `recruitment_scale_amount`. -Default: "1"} +Default: 1} \item{biomass_at_age_unit_label}{Abbreviated units for biomass at age @@ -136,7 +136,7 @@ Default: "mt"} \item{catch_scale_amount}{A number describing how much to scale down the catch quantities shown via bubble size. See `recruitment_scale_amount`. -Default: "1"} +Default: 1} } \value{ Rda files for each figure/table.