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
3 changes: 2 additions & 1 deletion R/plot_abundance_at_age.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ plot_abundance_at_age <- function(
if (make_rda == TRUE) {
create_rda(
object = plot,
topic_label = "pop.naa",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat,
unit_label = "mt"
Expand Down
2 changes: 1 addition & 1 deletion R/plot_biomass.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ plot_biomass <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = ifelse(relative, "relative.biomass", "biomass"),
topic_label = ifelse(relative, "relative_biomass", "biomass"),
fig_or_table = "figure",
dat = rp_dat,
dir = figures_dir,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_biomass_at_age.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ plot_biomass_at_age <- function(
if (make_rda == TRUE) {
create_rda(
object = plot,
topic_label = "pop.baa",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat,
unit_label = "mt"
Expand Down
3 changes: 2 additions & 1 deletion R/plot_catch_comp.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ plot_catch_comp <- function(
if (make_rda == TRUE) {
create_rda(
object = plot,
topic_label = "pop.caa",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat,
unit_label = "mt"
Expand Down
2 changes: 1 addition & 1 deletion R/plot_fishing_mortality.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ plot_fishing_mortality <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = ifelse(relative, "relative.fishing.mortality", "fishing.mortality"),
topic_label = ifelse(relative, "relative_fishing_mortality", "fishing_mortality"),
fig_or_table = "figure",
dat = dat,
dir = figures_dir,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_indices.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ plot_indices <- function(
if (make_rda) {
create_rda(
object = plt,
topic_label = "CPUE.indices",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = dat,
dir = figures_dir,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_landings.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ plot_landings <- function(
if (make_rda) {
create_rda(
object = plt,
topic_label = "landings",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = dat,
dir = figures_dir,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_natural_mortality.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ plot_natural_mortality <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = "natural.mortality",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = dat,
dir = figures_dir
Expand Down
3 changes: 2 additions & 1 deletion R/plot_recruitment.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ plot_recruitment <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = caption_label,
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = dat,
dir = figures_dir # ,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_recruitment_deviations.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ plot_recruitment_deviations <- function(
}
create_rda(
object = final,
topic_label = "recruitment.deviations",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = selected_dat,
dir = figures_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 @@ -207,7 +207,7 @@ plot_spawning_biomass <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = ifelse(relative, "relative.spawning.biomass", "spawning.biomass"),
topic_label = ifelse(relative, "relative_spawning_biomass", "spawning_biomass"),
fig_or_table = "figure",
dat = rp_dat,
dir = figures_dir,
Expand Down
3 changes: 2 additions & 1 deletion R/plot_stock_recruitment.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ plot_stock_recruitment <- function(
if (make_rda) {
create_rda(
object = final,
topic_label = "sr",
# get name of function and remove "plot_" from it
topic_label = gsub("plot_", "", as.character(sys.call()[[1]])),
fig_or_table = "figure",
dat = dat,
dir = figures_dir # ,
Expand Down
5 changes: 3 additions & 2 deletions R/table_bnc.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,13 @@
# fig_or_table = fig_or_table,
# dir = tables_dir
# )

#
# export_rda(
# object = final,
# caps_alttext = caps_alttext,
# figures_tables_dir = tables_dir,
# topic_label = topic_label,
# # get name of function and remove "table_" from it
# topic_label = gsub("table_", "", as.character(sys.call()[[1]])),
# fig_or_table = fig_or_table
# )
# }
Expand Down
15 changes: 8 additions & 7 deletions R/table_indices.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,14 @@
# )


# export_rda(
# object = final,
# caps_alttext = caps_alttext,
# figures_tables_dir = tables_dir,
# topic_label = topic_label,
# fig_or_table = fig_or_table
# )
# export_rda(
# object = final,
# caps_alttext = caps_alttext,
# figures_tables_dir = tables_dir,
# # get name of function and remove "table_" from it
# topic_label = gsub("table_", "", as.character(sys.call()[[1]])),
# fig_or_table = fig_or_table
# )
# }
# final
# }
3 changes: 2 additions & 1 deletion R/table_landings.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ table_landings <- function(
if (length(df_list) == 1) {
create_rda(
object = final$label,
topic_label = "landings",
# get name of function and remove "table_" from it
topic_label = gsub("table_", "", as.character(sys.call()[[1]])),
fig_or_table = "table",
dat = dat,
dir = tables_dir,
Expand Down
12 changes: 8 additions & 4 deletions R/utils_rda.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ add_more_key_quants <- function(

# calculate key quantities that rely on end_year for calculation
## terminal fishing mortality
# if (topic_cap_alt$label == "fishing.mortality") {
# if (topic_cap_alt$label == "fishing_mortality") {
# if (is.null(dat)) {
# cli::cli_alert_warning("Some key quantities associated with fishing mortality were not extracted and added to captions_alt_text.csv due to missing data file (i.e., 'dat' argument).", wrap = TRUE)
# } else {
Expand Down Expand Up @@ -195,6 +195,10 @@ add_more_key_quants <- function(
# write analogous code for each in this section, and remove placeholders from
# the end of write_captions (once we get clarity about how to extract Btarg,
# ssbtarg, and R0)
#

#TODO: When adding code extracting values for landings and/or indices figures/tables, be aware that both figure/table share the same label ("landings" and "indices"). If there's reason, add in extra conditional to check if value is from a figure or table

## biomass
if (topic_cap_alt$label == "biomass") {
if (is.null(dat)) {
Expand Down Expand Up @@ -247,7 +251,7 @@ add_more_key_quants <- function(
}

## relative spawning biomass
if (topic_cap_alt$label == "relative.spawning.biomass") {
if (topic_cap_alt$label == "relative_spawning_biomass") {
if (is.null(dat)) {
cli::cli_alert_warning("Some key quantities associated with relative spawning biomass were not extracted and added to captions_alt_text.csv due to missing data file (i.e., 'dat' argument).", wrap = TRUE)
}
Expand Down Expand Up @@ -318,7 +322,7 @@ add_more_key_quants <- function(
}

## spawning biomass
if (topic_cap_alt$label == "spawning.biomass" | topic_cap_alt$label == "sr") {
if (topic_cap_alt$label == "spawning_biomass" | topic_cap_alt$label == "stock_recruitment") {
if (is.null(dat)) {
cli::cli_alert_warning("Some key quantities associated with spawning biomass were not extracted and added to captions_alt_text.csv due to missing data file (i.e., 'dat' argument).", wrap = TRUE)
} else {
Expand Down Expand Up @@ -423,7 +427,7 @@ add_more_key_quants <- function(
}

## recruitment
if (topic_cap_alt$label == "recruitment" | topic_cap_alt$label == "sr") {
if (topic_cap_alt$label == "recruitment" | topic_cap_alt$label == "stock_recruitment") {
if (is.null(dat)) {
cli::cli_alert_warning("Some key quantities associated with recruitment were not extracted and added to captions_alt_text.csv due to missing data file (i.e., 'dat' argument).", wrap = TRUE)
} else {
Expand Down
Loading
Loading