Skip to content
Merged
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
6 changes: 5 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
^\.positai$
^\.claude$
^\.octocov\.yml$
^\.devcontainer$
^\.devcontainer$
^CITATION\.cff$
^CODE_OF_CONDUCT\.md$
^CONTRIBUTING\.md$
^(R|data|inst|tests|vignettes)/README\.md$
4 changes: 3 additions & 1 deletion .github/workflows/update-ss3-example-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
extra-packages: any::pak, any::usethis, local::.

- name: Update example data
run: Rscript data-raw/DATASET_SS3.R
run: Rscript data-raw/DATASET_SS3-r4ss.R
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

- name: Commit and push updated example data
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ export(table_total_catch)
export(theme_noaa)
export(theme_table)
importFrom(lifecycle,deprecated)
importFrom(rlang,.data)
2 changes: 2 additions & 0 deletions R/conout_bam.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#' Does not change naming conventions.
#'
#' @inheritParams convert_output
#' @param out_new The empty standard output data frame from
#' [convert_output()], which sets the columns of the output.
#'
#' @returns Reshaped data frame.
conout_bam <- function(
Expand Down
2 changes: 2 additions & 0 deletions R/conout_rceattle.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#' Does not change naming conventions.
#'
#' @inheritParams convert_output
#' @param out_new The empty standard output data frame from
#' [convert_output()], which sets the columns of the output.
#'
#' @returns Reshaped data frame.
conout_rceattle <- function(
Expand Down
2 changes: 2 additions & 0 deletions R/conout_ss3.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#' file or returned object from `r4ss::ss_output()`.
#'
#' @inheritParams convert_output
#' @param out_new The empty standard output data frame from
#' [convert_output()], which sets the columns of the output.
#'
#' @returns Reshaped data frame.
conout_ss3 <- function(
Expand Down
12 changes: 5 additions & 7 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@

#' 2018 Gulf of Alaska Pollock stock assessment output
#'
#' Standardized output of the 2018 Gulf of Alaska Pollock stock assessment
#' produced from Rceattle including all of the values needed to create
#' plots and tables in {stockplotr}. The example can be found and run from the
#' Rceattle repository.
#' Output of the 2018 Gulf of Alaska Pollock stock assessment produced from Rceattle, standardized
#' using stockplotr::convert_output(). The example can be found and run from the Rceattle repository.
#'
#' @docType data
#'
Expand Down Expand Up @@ -93,7 +91,7 @@
#' @keywords datasets
#'
#' @references Adams, G. D., Holsman, K. K., Barbeaux, S. J., Dorn, M. W., Ianelli, J. N., Spies, I., … Punt, A. E. (2022)
#' (\href{https://doi.org/10.1016/j.fishres.2022.106303})
#' (\doi{10.1016/j.fishres.2022.106303})
#'
#' @source \href{https://github.com/afsc-assessments/Rceattle/blob/main/examples/Fit_2018_GOA_single-species_models.R}{Rceattle Example}
#'
Expand Down Expand Up @@ -152,7 +150,7 @@
#' @keywords datasets
#'
#' @references SEDAR (2018)
#' (\href{https://sedarweb.org/documents/sedar-55-stock-assessment-report-south-atlantic-vermilion-snapper/})
#' (\url{https://sedarweb.org/documents/sedar-55-stock-assessment-report-south-atlantic-vermilion-snapper/})
#'
#' @examples
#' data(vermilion_snapper)
Expand Down Expand Up @@ -215,4 +213,4 @@
#' data(ss3_simple)
#' head(ss3_simple)
#' unique(ss3_simple$label)
"ss3_simple"
"ss3_simple"
8 changes: 4 additions & 4 deletions R/extract_sis_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,15 @@ extract_sis_data <- function(sis_data_dir = getwd(),
cli::cli_alert_info("Existing sis_assmt_template.csv or sis_ts_template.csv found in {sis_data_dir}.")
overwrite <- readline("Do you want to overwrite the existing files? (y/n): ")
if (tolower(overwrite) == "y") {
write.csv(assmt_dat, assmt_dat_path, row.names = FALSE)
write.csv(ts_dat_filled, ts_dat_path, row.names = FALSE)
utils::write.csv(assmt_dat, assmt_dat_path, row.names = FALSE)
utils::write.csv(ts_dat_filled, ts_dat_path, row.names = FALSE)
cli::cli_alert_success("Files overwritten successfully.")
} else {
cli::cli_alert_info("Files not overwritten. Please rename the files, then rerun this function to save the data extracted in this function.")
}
} else {
write.csv(assmt_dat, assmt_dat_path, row.names = FALSE)
write.csv(ts_dat_filled, ts_dat_path, row.names = FALSE)
utils::write.csv(assmt_dat, assmt_dat_path, row.names = FALSE)
utils::write.csv(ts_dat_filled, ts_dat_path, row.names = FALSE)
cli::cli_alert_success("Files saved successfully in {sis_data_dir}.")
}

Expand Down
2 changes: 1 addition & 1 deletion R/plot_spawning_biomass.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ plot_spawning_biomass <- function(
ref_line = "msy",
unit_label = NULL,
era = NULL,
lbs = lifecycle::deprecate(),
lbs = lifecycle::deprecated(),
module = NULL,
scale_amount = 1,
relative = FALSE,
Expand Down
4 changes: 4 additions & 0 deletions R/save_all_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#' plotting functions for greater customization of figures and tables.
#'
#' @inheritParams plot_spawning_biomass
#' @param figures_tables_dir Path. Directory where the rda files are saved,
#' in "figures" and "tables" folders that are created if needed.
#'
#' Default: the working directory (`getwd()`)
#'
#' @param plot_recruitment_options List. List object of parameter values to pass
#' directly to the `plot_recruitment` function. All default parameters for the
Expand Down
1 change: 1 addition & 0 deletions R/stockplotr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## usethis namespace: start
#' @importFrom lifecycle deprecated
#' @importFrom rlang .data
## usethis namespace: end
NULL

Expand Down
8 changes: 4 additions & 4 deletions R/table_biomass_abundance_catch.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ table_biomass_abundance_catch <- function(
estimate_lower = mean(as.numeric(estimate_lower), na.rm = TRUE),
uncertainty_label = unique(uncertainty_label),
uncertainty = mean(uncertainty, na.rm = TRUE),
unit = unique(unit),
unit = unique(.data$unit),
Comment thread
Schiano-NOAA marked this conversation as resolved.
Resolved
.by = c(year, model, label)
) # |>
# dplyr::ungroup()
Expand All @@ -129,7 +129,7 @@ table_biomass_abundance_catch <- function(
estimate_lower = mean(as.numeric(estimate_lower), na.rm = TRUE),
uncertainty_label = unique(uncertainty_label),
uncertainty = mean(uncertainty, na.rm = TRUE),
unit = unique(unit),
unit = unique(.data$unit),
.by = c(year, model, label)
) # |>
# dplyr::ungroup()
Expand Down Expand Up @@ -163,8 +163,8 @@ table_biomass_abundance_catch <- function(
if (is.null(get(paste0(unit_name, "_label")))) {
unit_label <- filtered_data |>
dplyr::filter(grepl(x, unit_name),
!is.na(unit)) |>
dplyr::pull(unit) |>
!is.na(.data$unit)) |>
dplyr::pull("unit") |>
unique()
if (is.na(unit_label) || length(unit_label) == 0) {
cli::cli_alert_warning("No unit label found in the data for {unit_name}. Please provide a unit label using the '{unit_name}_label' argument.")
Expand Down
4 changes: 0 additions & 4 deletions R/utils_rda.R
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,6 @@ insert_kqs <- function(..., dir=getwd()) {
#'
#' Default: the working directory (`getwd()`)
#'
#' @param year Number. Assessment year
#'
#' Default: the current year
#'
#' @param ref_line String. Reference line value
#'
#' Default: "msy"
Expand Down
3 changes: 3 additions & 0 deletions man/conout_bam.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/conout_rceattle.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/conout_ss3.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions man/create_rda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot_spawning_biomass.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/pollock.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/save_all_plots.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/vermilion_snapper.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading