diff --git a/NAMESPACE b/NAMESPACE index cc24a80..4cba569 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,8 @@ export(add_theme) export(exp_fig_accessible) export(plot_landings) export(plot_recruitment) +export(plot_recruitment_deviations) +export(plot_spawn_recruitment) export(plot_spawning_biomass) export(plot_total_biomass) export(table_indices) diff --git a/R/plot_recruitment_deviations.R b/R/plot_recruitment_deviations.R index 2287954..975c77b 100644 --- a/R/plot_recruitment_deviations.R +++ b/R/plot_recruitment_deviations.R @@ -2,18 +2,16 @@ #' #' @inheritParams plot_recruitment #' -#' @returnPlot Plot recruitment deviations relative to one over time from an assessment model output file -#' translated to a standardized output. There are options to return a {ggplot2} -#' object or export an .rda object containing associated caption and alternative -#' text for the figure. +#' @return Plot recruitment deviations relative to one over time from an +#' assessment model output file translated to a standardized output. There are +#' options to return a {ggplot2} object or export an .rda object containing +#' associated caption and alternative text for the figure. #' @export #' -#' @examples -plot_recruitment_deviations <- function( +plot_recruitment_deviations <- function ( dat = NULL, end_year = NULL, - n_projected_years = 10, - + n_projected_years = 10 ) { if (is.null(end_year)) { end_year <- max(as.numeric(dat$year), na.rm = TRUE) - n_projected_years diff --git a/R/plot_spawn_recruitment.R b/R/plot_spawn_recruitment.R index 2b7ebe3..1d50de6 100644 --- a/R/plot_spawn_recruitment.R +++ b/R/plot_spawn_recruitment.R @@ -4,10 +4,9 @@ #' @param spawning_biomass_label Units for spawning biomass #' @param recruitment_label units for recruitment #' -#' @return +#' @return Plot spawning recruitment relationship from a standardized output file originating from asar::convert_output() #' @export #' -#' @examples plot_spawn_recruitment <- function( dat = NULL, spawning_biomass_label = "metric tons", @@ -62,5 +61,5 @@ plot_spawn_recruitment <- function( ggplot2::labs(x = glue::glue("Spawning Biomass ({spawning_biomass_label})"), y = glue::glue("Recruitment ({recruitment_label})")) + ggplot2::theme(legend.position = "none") - # sr_plt <- add_theme(sr_plt) + suppressWarnings(add_theme(sr_plt)) } diff --git a/man/plot_recruitment.Rd b/man/plot_recruitment.Rd index c8f6da9..e243f89 100644 --- a/man/plot_recruitment.Rd +++ b/man/plot_recruitment.Rd @@ -6,46 +6,34 @@ \usage{ plot_recruitment( dat, - params = FALSE, - params_only = FALSE, - units = c(sb = "metric tons", recruitment = "metric tons"), - recruitment_units = "metric tons", - spawning_biomass_units = "metric tons", - scaled = FALSE, - scale_amount = NULL, - show_warnings = FALSE, + unit_label = "metric tons", + scale_amount = 1, end_year = NULL, - return = "recruitment" + n_projected_years = 10, + relative = FALSE ) } \arguments{ \item{dat}{A data frame returned from `asar::convert_output()`.} -\item{params}{Print/export the parameters of the stock recruitment function?} - -\item{params_only}{Only export the stock recruitment function or both the parameters and the plot(s)?} - -\item{units}{If units are not available in the output file, in metric tons, -or are different for SB and R, then report them here starting with SB units -and following with R units.} - -\item{recruitment_units}{units for recruitment} - -\item{spawning_biomass_units}{units of spawning biomass if different from biomass} - -\item{scaled}{T/F; indicate whether the output values for biomass and recruitment are scaled} +\item{unit_label}{units for recruitment} \item{scale_amount}{indicate the exact amount of scale (i.e. 1000)} -\item{show_warnings}{Include warnings? Default FALSE} - \item{end_year}{last year of assessment} -\item{return}{Default returns recruitment over time. Options to display recruitment time series, stock recruitment curve, or recruitment fit} +\item{n_projected_years}{Number of years spawning biomass is projected for. +By default this number is set to 10} + +\item{relative}{A logical value specifying if the resulting figures should +be relative spawning biomass. The default is `FALSE`. `ref_line` indicates +which reference point to use.} } \value{ -A series of plots are exported including recruitment over time with R0 -reference line, stock recruitment curve, and other related figures. +Plot recruitment over time from an assessment model output file +translated to a standardized output. There are options to return a {ggplot2} +object or export an rda object containing associated caption and alternative +text for the figure. } \description{ Plot Recruitment diff --git a/man/plot_recruitment_deviations.Rd b/man/plot_recruitment_deviations.Rd new file mode 100644 index 0000000..e17a8e6 --- /dev/null +++ b/man/plot_recruitment_deviations.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot_recruitment_deviations.R +\name{plot_recruitment_deviations} +\alias{plot_recruitment_deviations} +\title{Plot Recruitment Deviations} +\usage{ +plot_recruitment_deviations( + dat = NULL, + end_year = NULL, + n_projected_years = 10 +) +} +\value{ +Plot recruitment deviations relative to one over time from an +assessment model output file translated to a standardized output. There are +options to return a {ggplot2} object or export an .rda object containing +associated caption and alternative text for the figure. +} +\description{ +@inheritParams plot_recruitment +} diff --git a/man/plot_spawn_recruitment.Rd b/man/plot_spawn_recruitment.Rd new file mode 100644 index 0000000..52d6b25 --- /dev/null +++ b/man/plot_spawn_recruitment.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot_spawn_recruitment.R +\name{plot_spawn_recruitment} +\alias{plot_spawn_recruitment} +\title{Plot Spawn-Recruit Curve} +\usage{ +plot_spawn_recruitment( + dat = NULL, + spawning_biomass_label = "metric tons", + recruitment_label = "metric tons", + end_year = NULL +) +} +\value{ +Plot spawning recruitment relationship from a standardized output file originating from asar::convert_output() +} +\description{ +@inheritParams plot_recruitment + @param spawning_biomass_label Units for spawning biomass + @param recruitment_label units for recruitment +} diff --git a/man/plot_spawning_biomass.Rd b/man/plot_spawning_biomass.Rd index eb014f1..3c6f33e 100644 --- a/man/plot_spawning_biomass.Rd +++ b/man/plot_spawning_biomass.Rd @@ -10,12 +10,15 @@ plot_spawning_biomass( scale_amount = 1, ref_line = c("target", "unfished"), end_year = NULL, - relative = FALSE + relative = FALSE, + n_projected_years = 10 ) } \arguments{ \item{dat}{A data frame returned from `asar::convert_output()`.} +\item{unit_label}{units for recruitment} + \item{scale_amount}{indicate the exact amount of scale (i.e. 1000)} \item{ref_line}{A string specifying the type of reference you want to @@ -31,6 +34,9 @@ regardless of how it is specified in `dat`.} \item{relative}{A logical value specifying if the resulting figures should be relative spawning biomass. The default is `FALSE`. `ref_line` indicates which reference point to use.} + +\item{n_projected_years}{Number of years spawning biomass is projected for. +By default this number is set to 10} } \value{ Plot spawning biomass from the results of an assessment model translated to