Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export(plot_abundance_at_age)
export(plot_biomass)
export(plot_biomass_at_age)
export(plot_catch_comp)
export(plot_composition_andre)
export(plot_composition_bubble)
export(plot_composition_distribution)
export(plot_composition_francis)
export(plot_composition_residual_distribution)
export(plot_composition_residual_pattern)
export(plot_composition_residuals)
export(plot_composition_samples)
export(plot_composition_sexratio)
export(plot_discard)
export(plot_fishing_mortality)
export(plot_index)
Expand All @@ -23,8 +32,10 @@ export(plot_recruitment)
export(plot_recruitment_deviations)
export(plot_selectivity)
export(plot_spawning_biomass)
export(plot_spawning_potential_ratio)
export(plot_stock_recruitment)
export(plot_timeseries)
export(prepare_composition_data)
export(process_data)
export(process_table)
export(reference_line)
Expand Down
14 changes: 14 additions & 0 deletions R/convert_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,20 @@ convert_output <- function(
TRUE ~ NA_character_
)
)
# Composition data by bin from r4ss (lendbase, agedbase, condbase)
if (!is.character(file)) {
comp_rows <- ss3_composition_rows(
dat,
fleet_names = fleet_names,
start_year = start_year,
end_year = end_year,
columns = names(out_new)
)
if (!is.null(comp_rows)) {
cli::cli_alert("Processing composition data (lendbase, agedbase, condbase)")
out_new <- rbind(out_new, comp_rows)
}
}
} else if (model %in% c("bam", "BAM")) {
#### BAM ####
# Extract values from BAM output - model file after following ADMB2R
Expand Down
64 changes: 64 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,67 @@
#' }
#'
"example_data"

#' Big Skate length composition data
#'
#' Length compositions and fits from the 2019 Big Skate stock assessment for
#' the U.S. West Coast (`BigSkate_2019` in the Stock Synthesis test models),
#' the model used for the r4ss example plots at
#' \url{https://r4ss.github.io/r4ss/BigSkate/}. The data are the `lendbase`
#' rows of [convert_output()] applied to the output of `r4ss::SS_output()`.
#' See `data-raw/bigskate_comps.R`.
#'
#' Compositions are sex-specific, with female and male proportions summing to
#' one within each year, fleet, and partition. `Fishery_current` has separate
#' retained and discarded compositions.
#'
#' @format A tibble in the standard [convert_output()] format with 14504 rows
#' and 35 columns. The columns used for compositions are:
#' \describe{
#' \item{label}{"length_composition_observed", "length_composition_predicted",
#' "length_composition_pearson_residual" (as reported by Stock Synthesis),
#' or "length_composition_sample_size" (adjusted input sample size,
#' `Nsamp_adj` in r4ss)}
#' \item{estimate}{Value of the label}
#' \item{module_name}{`"lendbase"`}
#' \item{year}{Year of the observation}
#' \item{fleet}{Fleet name: "Fishery_current", "WCGBTS", or "Triennial"}
#' \item{sex}{"female" or "male"}
#' \item{part}{Partition: 0 = whole catch, 1 = discard, 2 = retained}
#' \item{length_bins}{Lower edge of the length bin (cm)}
#' }
#' @source Taylor, I.G., Gertseva, V., Stephens, A., and Bizzarro, J. (2019). Status of
#' Big Skate (Beringraja binoculata) off the U.S. Pacific Coast in 2019.
#' Pacific Fishery Management Council, Portland, OR.
#' @seealso [bigskate_caal], [prepare_composition_data()], [plot_composition_distribution()]
"bigskate_lencomp"

#' Big Skate conditional age-at-length data
#'
#' Conditional age-at-length data and fits from the 2019 Big Skate stock
#' assessment (see [bigskate_lencomp]). The data are the `condbase` rows of
#' [convert_output()] applied to the output of `r4ss::SS_output()`. Each age
#' composition is for one sex and one length bin, and sums to one. See
#' `data-raw/bigskate_comps.R`.
#'
#' @format A tibble in the standard [convert_output()] format with 26240 rows
#' and 35 columns. The columns used for compositions are:
#' \describe{
#' \item{label}{"conditional_age_composition_observed",
#' "conditional_age_composition_predicted",
#' "conditional_age_composition_pearson_residual", or
#' "conditional_age_composition_sample_size"}
#' \item{estimate}{Value of the label}
#' \item{module_name}{`"condbase"`}
#' \item{year}{Year of the observation}
#' \item{fleet}{Fleet name: "Fishery_current" or "WCGBTS"}
#' \item{sex}{"female" or "male"}
#' \item{part}{Partition: 0 = whole catch, 1 = discard, 2 = retained}
#' \item{length_bins}{Length bin the ages are conditioned on (`Lbin_lo` in r4ss)}
#' \item{age}{Age}
#' }
#' @source Taylor, I.G., Gertseva, V., Stephens, A., and Bizzarro, J. (2019). Status of
#' Big Skate (Beringraja binoculata) off the U.S. Pacific Coast in 2019.
#' Pacific Fishery Management Council, Portland, OR.
#' @seealso [bigskate_lencomp], [prepare_composition_data()], [plot_composition_andre()]
"bigskate_caal"
Loading
Loading