diff --git a/DESCRIPTION b/DESCRIPTION index 9958ccf4..c01a6884 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,9 +18,11 @@ Imports: gridExtra, gt, naniar, + nmfspalette, officer, openxlsx, prodlim, + r4ss, satf, stats, stringr, @@ -40,7 +42,8 @@ VignetteBuilder: knitr Remotes: nmfs-ost/satf, - r4ss/r4ss + r4ss/r4ss, + nmfs-fish-tools/nmfspalette Config/testthat/edition: 3 Config/testthat/parallel: true Encoding: UTF-8 diff --git a/R/add_base_section.R b/R/add_base_section.R index 0fee568f..e0edf650 100644 --- a/R/add_base_section.R +++ b/R/add_base_section.R @@ -11,12 +11,12 @@ add_base_section <- function(custom_sections) { section_list <- list() for (i in 1:length(sec_sel)) { sec_file <- grep( - custom_sections = list.files(system.file("templates", "skeleton", package = "asar")), + list.files(system.file("templates", "skeleton", package = "asar")), pattern = sec_sel[i], value = TRUE ) if (identical(sec_file, character(0))) stop("One or more section name(s) does not exist. Please check the spelling or if you are tring to add a section that is not in the default template, please use parameter 'custom_sections' and refer to documentation. To check which sections are in the base template please run list.files(system.file('templates', 'skeleton', package = 'ASAR')) in your console") - sec_file -> section_list[i] + sec_file -> section_list[[i]] } - section_list + as.list(unlist(section_list)) } diff --git a/R/add_section.R b/R/add_section.R index f9271b5d..bc61cea0 100644 --- a/R/add_section.R +++ b/R/add_section.R @@ -26,7 +26,7 @@ add_section <- function( # after-section # in-section (will always append to the end of the section) for (i in 1:length(new_section)) { - section_i_name <- paste0(gsub(" ", "_", new_section[i]), ".qmd") + section_i_name <- paste0(gsub(" ", "_", tolower(new_section[i])), ".qmd") local_section <- forstringr::str_extract_part(section_location[i], "-", before = FALSE) local_section_prev <- forstringr::str_extract_part(section_location[i - 1], "-", before = FALSE) @@ -39,7 +39,7 @@ add_section <- function( } section_i <- paste0( - "## ", stringr::str_to_title(sub("_", " ", new_section[i])), "\n", + "## ", stringr::str_to_title(sub("_", " ", tolower(new_section[i]))), "\n", "\n", "[Insert text here]", "\n", "\n", @@ -51,9 +51,9 @@ add_section <- function( custom_sections <- append(custom_sections, section_i_name, after = (which(grepl(local_section, custom_sections)) - 1)) } else if (locality == "after") { if (locality %in% locality_prev & local_section %in% local_section_prev) { - custom_sections <- append(custom_sections, section_i_name, after = which(grepl(gsub(" ", "_", new_section[i - 1]), custom_sections))) + custom_sections <- append(custom_sections, section_i_name, after = which(grepl(gsub(" ", "_", tolower(new_section[i - 1])), custom_sections))) } else { - custom_sections <- append(custom_sections, section_i_name, after = which(grepl(local_section, custom_sections))) + custom_sections <- append(custom_sections, section_i_name, after = max(which(grepl(local_section, custom_sections)))) } } else if (locality == "in") { stop("No available option for adding a new section 'in' another quarto document.", call. = FALSE) diff --git a/R/create_figures_doc.R b/R/create_figures_doc.R index bd30b62f..e0f1301b 100644 --- a/R/create_figures_doc.R +++ b/R/create_figures_doc.R @@ -28,6 +28,7 @@ create_figures_doc <- function(resdir = NULL, add_chunk( paste0("satf::plot_recruitment(dat = '", resdir, "/", model_results, "', model = '", model, "')"), label = "recruitment", + eval = "false", add_option = TRUE, chunk_op = "fig-cap: 'this is the caption for the figure.'" ), @@ -41,7 +42,7 @@ create_figures_doc <- function(resdir = NULL, ) figures_doc <- paste0( figures_doc, - add_chunk(plot_code, label = "spawn_bio"), + add_chunk(plot_code, label = "spawn_bio", eval = "false"), "\n" ) } else { @@ -49,5 +50,5 @@ create_figures_doc <- function(resdir = NULL, } # Save tables doc to template folder - utils::capture.output(cat(figures_doc), file = paste0(subdir, "/", "figures.qmd"), append = FALSE) + utils::capture.output(cat(figures_doc), file = paste0(subdir, "/", "09_figures.qmd"), append = FALSE) } diff --git a/R/create_tables_doc.R b/R/create_tables_doc.R index 647684b0..c1438683 100644 --- a/R/create_tables_doc.R +++ b/R/create_tables_doc.R @@ -26,7 +26,8 @@ create_tables_doc <- function(resdir = NULL, paste0( "satf::table_indices(dat = '", resdir, "/", model_results, "', model = '", model, "')" ), - label = "indices" + label = "indices", + eval = "false" ) ) @@ -44,5 +45,7 @@ create_tables_doc <- function(resdir = NULL, } # Save tables doc to template folder - utils::capture.output(cat(tables_doc), file = paste0(subdir, "/", "tables.qmd"), append = FALSE) + utils::capture.output(cat(tables_doc), + file = paste0(subdir, "/", "08_tables.qmd"), + append = FALSE) } diff --git a/R/create_template.R b/R/create_template.R index 6781c0ff..7ab0c780 100644 --- a/R/create_template.R +++ b/R/create_template.R @@ -276,7 +276,7 @@ create_template <- function( "### Tables \n \n", "Please refer to the `satf` package downloaded from remotes::install_github('nmfs-ost/satf') to add premade tables." ) - utils::capture.output(cat(tables_doc), file = fs::path(subdir, "tables.qmd"), append = FALSE) + utils::capture.output(cat(tables_doc), file = fs::path(subdir, "08_tables.qmd"), append = FALSE) warning("Results file or model name not defined.") } } else { @@ -284,7 +284,7 @@ create_template <- function( "### Tables \n \n", "Please refer to the `satf` package downloaded from remotes::install_github('nmfs-ost/satf') to add premade figures" ) - utils::capture.output(cat(tables_doc), file = fs::path(subdir, "tables.qmd"), append = FALSE) + utils::capture.output(cat(tables_doc), file = fs::path(subdir, "08_tables.qmd"), append = FALSE) } # Create figures qmd if (include_figures) { @@ -298,12 +298,12 @@ create_template <- function( ) } else { figures_doc <- paste0("## Figures \n") - utils::capture.output(cat(figures_doc), file = fs::path(subdir, "figures.qmd"), append = FALSE) + utils::capture.output(cat(figures_doc), file = fs::path(subdir, "09_figures.qmd"), append = FALSE) warning("Results file or model name not defined.") } } else { figures_doc <- paste0("## Figures \n") - utils::capture.output(cat(figures_doc), file = fs::path(subdir, "figures.qmd"), append = FALSE) + utils::capture.output(cat(figures_doc), file = fs::path(subdir, "09_figures.qmd"), append = FALSE) } # Part I @@ -441,6 +441,7 @@ create_template <- function( # Date "date: today", "\n", "lang: en \n", + "keep-tex: true \n" ) # Add species image on title page @@ -569,32 +570,38 @@ create_template <- function( if (custom == FALSE) { sections <- add_child( c( - "executive_summary.qmd", - "introduction.qmd", - "data.qmd", - "modeling_approach.qmd", - "results.qmd", - "projections.qmd", - "discussion.qmd", - "acknowledgments.qmd", - "references.qmd", - "tables.qmd", - "figures.qmd", - "appendix.qmd" + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_asessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd" ), label = c( - "executive_summary", - "introduction", - "data", - "modeling_approach", - "results", - "projections", - "discussion", - "acknowlesgements", - "references", - "tables", - "figures", - "appendix" + "01_executive_summary", + "02_introduction", + "03_data", + "04a_assessment-configuration", + "04b_assessment-results", + "04c_assessment-sensitivity", + "04d_asessment-benchmarks", + "04e_assessment-projections", + "05_discussion", + "06_acknowledgments", + "07_references", + "08_tables", + "09_figures", + "10_notes", + "11_appendix" ) ) } else { @@ -611,18 +618,21 @@ create_template <- function( if (is.null(custom_sections)) { sec_list1 <- list( - "executive_summary.qmd", - "introduction.qmd", - "data.qmd", - "modeling_approach.qmd", - "results.qmd", - "projections.qmd", - "discussion.qmd", - "acknowledgments.qmd", - "references.qmd", - "tables.qmd", - "figures.qmd", - "appendix.qmd" + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_asessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd" ) sec_list2 <- add_section( new_section = new_section, @@ -645,10 +655,10 @@ create_template <- function( stop("Defined customizations do not match one or all of the relative placement of a new section. Please review inputs.") } if (include_tables) { - sec_list1 <- c(sec_list1, "tables.qmd") + sec_list1 <- c(sec_list1, "08_tables.qmd") } if (include_figures) { - sec_list1 <- c(sec_list1, "figures.qmd") + sec_list1 <- c(sec_list1, "09_figures.qmd") } sec_list2 <- add_section( new_section = new_section, @@ -736,32 +746,38 @@ create_template <- function( if (custom == FALSE) { sections <- add_child( c( - "executive_summary.qmd", - "introduction.qmd", - "data.qmd", - "modeling_approach.qmd", - "results.qmd", - "projections.qmd", - "discussion.qmd", - "acknowledgments.qmd", - "references.qmd", - "tables.qmd", - "figures.qmd", - "appendix.qmd" + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_asessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd" ), label = c( - "executive_summary", - "introduction", - "data", - "modeling_approach", - "results", - "projections", - "discussion", - "acknowlesgements", - "references", - "tables", - "figures", - "appendix" + "01_executive_summary", + "02_introduction", + "03_data", + "04a_assessment-configuration", + "04b_assessment-results", + "04c_assessment-sensitivity", + "04d_asessment-benchmarks", + "04e_assessment-projections", + "05_discussion", + "06_acknowledgments", + "07_references", + "08_tables", + "09_figures", + "10_notes", + "11_appendix" ) ) } else { @@ -778,22 +794,25 @@ create_template <- function( if (is.null(custom_sections)) { sec_list1 <- list( - "executive_summary.qmd", - "introduction.qmd", - "data.qmd", - "modeling_approach.qmd", - "results.qmd", - "projections.qmd", - "discussion.qmd", - "acknowledgments.qmd", - "references.qmd", - "tables.qmd", - "figures.qmd", - "appendix.qmd" + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_asessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd" ) sec_list2 <- add_section( new_section = new_section, - new_section = section_location, + section_location = section_location, custom_sections = sec_list1, subdir = subdir ) @@ -808,7 +827,7 @@ create_template <- function( # Create new sections as .qmd in folder sec_list2 <- add_section( new_section = new_section, - new_section = section_location, + section_location = section_location, custom_sections = sec_list1, subdir = subdir ) diff --git a/R/utils.R b/R/utils.R index 610e7995..944400e4 100644 --- a/R/utils.R +++ b/R/utils.R @@ -2,31 +2,6 @@ #### Utilities #### ######################### -#---- add_base_section ---- - -#' Add selected sections to outline -#' -#' @param x inherited 'custom_sections' parameter from create_template -#' -#' @return Call and copy the sections in the package templates to create an outline for a stock assessment -#' @noRd -#' -#' @examples add_base_section(c("abstract", "model", "results")) -add_base_section <- function(x) { - sec_sel <- gsub(" ", "_", tolower(gsub("(.)([A-Z])", "\\1 \\2", x))) - section_list <- list() - for (i in 1:length(sec_sel)) { - sec_file <- grep( - x = list.files(system.file("templates", "skeleton", package = "asar")), - pattern = sec_sel[i], - value = TRUE - ) - if (identical(sec_file, character(0))) stop("One or more section name(s) does not exist. Please check the spelling or if you are tring to add a section that is not in the default template, please use parameter 'custom_sections' and refer to documentation. To check which sections are in the base template please run list.files(system.file('templates', 'skeleton', package = 'ASAR')) in your console") - sec_file -> section_list[i] - } - section_list -} - #---- get_ncol ---- # Helper for SS3 output converter # Sourced from r4ss diff --git a/inst/templates/skeleton/01_executive_summary.qmd b/inst/templates/skeleton/01_executive_summary.qmd new file mode 100644 index 00000000..d9ee0f7a --- /dev/null +++ b/inst/templates/skeleton/01_executive_summary.qmd @@ -0,0 +1,12 @@ +## Executive Summary + + + +### Assessment Model + + + +### Reference Points, Stock Status, and Projections + + + diff --git a/inst/templates/skeleton/02_introduction.qmd b/inst/templates/skeleton/02_introduction.qmd new file mode 100644 index 00000000..50ef8274 --- /dev/null +++ b/inst/templates/skeleton/02_introduction.qmd @@ -0,0 +1,25 @@ +## Introduction + +Testing adding in an introduction for `r params$species`. There is currently no read of parameters for child documents. + + + + +### Management History + + + +### Fishery Descriptions + + + +### Ecosystem Considerations + + + diff --git a/inst/templates/skeleton/03_data.qmd b/inst/templates/skeleton/03_data.qmd new file mode 100644 index 00000000..2881d805 --- /dev/null +++ b/inst/templates/skeleton/03_data.qmd @@ -0,0 +1,31 @@ +## Data + + + +### Stock ID + + + +### Life History + + + +### Landings + + + +### Indices and Standardization + + + +### Composition Data + + + +### Absolute Abundance + + + +### Environmental/Ecosystem Indicator Data + + diff --git a/inst/templates/skeleton/04a_assessment-configuration.qmd b/inst/templates/skeleton/04a_assessment-configuration.qmd new file mode 100644 index 00000000..e865ae17 --- /dev/null +++ b/inst/templates/skeleton/04a_assessment-configuration.qmd @@ -0,0 +1,11 @@ +## Assessment + +### Current Modeling Approach + + + +### Configuration of the Base Model + + + + diff --git a/inst/templates/skeleton/04b_assessment-results.qmd b/inst/templates/skeleton/04b_assessment-results.qmd new file mode 100644 index 00000000..55dee7fd --- /dev/null +++ b/inst/templates/skeleton/04b_assessment-results.qmd @@ -0,0 +1,14 @@ +### Modeling Results + + + +#### Parameter Estimates + + +#### Recruitment Estimates and Deviations + + +#### Model Fits + + +#### Model Diagnostics diff --git a/inst/templates/skeleton/04c_assessment-sensitivity.qmd b/inst/templates/skeleton/04c_assessment-sensitivity.qmd new file mode 100644 index 00000000..a3549592 --- /dev/null +++ b/inst/templates/skeleton/04c_assessment-sensitivity.qmd @@ -0,0 +1 @@ +### Sensitivity Analyses diff --git a/inst/templates/skeleton/04d_assessment-benchmarks.qmd b/inst/templates/skeleton/04d_assessment-benchmarks.qmd new file mode 100644 index 00000000..816a6e59 --- /dev/null +++ b/inst/templates/skeleton/04d_assessment-benchmarks.qmd @@ -0,0 +1,3 @@ +### Management Benchmarks + + diff --git a/inst/templates/skeleton/04e_assessment-projections.qmd b/inst/templates/skeleton/04e_assessment-projections.qmd new file mode 100644 index 00000000..7c06e550 --- /dev/null +++ b/inst/templates/skeleton/04e_assessment-projections.qmd @@ -0,0 +1,3 @@ +### Projections + + diff --git a/inst/templates/skeleton/05_discussion.qmd b/inst/templates/skeleton/05_discussion.qmd new file mode 100644 index 00000000..c342da89 --- /dev/null +++ b/inst/templates/skeleton/05_discussion.qmd @@ -0,0 +1,3 @@ +## Discussion + + diff --git a/inst/templates/skeleton/acknowledgments.qmd b/inst/templates/skeleton/06_acknowledgments.qmd similarity index 100% rename from inst/templates/skeleton/acknowledgments.qmd rename to inst/templates/skeleton/06_acknowledgments.qmd diff --git a/inst/templates/skeleton/references.qmd b/inst/templates/skeleton/07_references.qmd similarity index 100% rename from inst/templates/skeleton/references.qmd rename to inst/templates/skeleton/07_references.qmd diff --git a/inst/templates/skeleton/10_notes.qmd b/inst/templates/skeleton/10_notes.qmd new file mode 100644 index 00000000..9c179a38 --- /dev/null +++ b/inst/templates/skeleton/10_notes.qmd @@ -0,0 +1,3 @@ +## Notes + + diff --git a/inst/templates/skeleton/appendix.qmd b/inst/templates/skeleton/11_appendix.qmd similarity index 100% rename from inst/templates/skeleton/appendix.qmd rename to inst/templates/skeleton/11_appendix.qmd diff --git a/inst/templates/skeleton/assessment_glossaries.tex b/inst/templates/skeleton/assessment_glossaries.tex deleted file mode 100644 index 389f2933..00000000 --- a/inst/templates/skeleton/assessment_glossaries.tex +++ /dev/null @@ -1,278 +0,0 @@ -% Glossary from sa4ss - NW and SW FSC -\newacronym{abc}{ABC}{Acceptable Biological Catch} -\newacronym{ace}{ACE}{Army Corp of Engineers} -\newacronym{acl}{ACL}{annual catch limit} -\newacronym{act}{ACT}{annual catch target} -\newacronym{adfg}{ADF\&G}{Alaska Department of Fish and Game} -\newacronym{admb}{ADMB}{AD Model Builder} -\newacronym{afa}{AFA}{American Fisheries Act} -\newacronym{afsc}{AFSC}{Alaska Fisheries Science Center} -\newacronym{aic}{AIC}{Akaike information criterion} -\newacronym{ais}{AIS}{Automatic Identification System} -\newacronym{akfin}{AKFIN}{Alaska Fisheries Information Network} -\newacronym{akro}{AKRO}{Alaska Regional Office} -\newacronym{am}{AM}{accountability measures} -\newacronym{apecs}{APECS}{Assessment Profile, Ecosystem Considerations, and Socioeconomics} -\newacronym{ashop}{ASHOP}{At-Sea Hake Observer Program} -\newacronym{asmfc}{ASMFC}{Atlantic States Marine Fisheries Commission} -\newacronym{bac}{BAC}{Block Area Closure} -\newacronym{bcca}{BCCA}{Bottom Contact Closed Area} -\newacronym{bcigfp}{Integrated Program}{British Columbia Integrated Groundfish Program} -\newacronym{bic}{BIC}{Bayesian information criterion} -\newacronym{bo}{BO}{Biological Opinion} -\newacronym{brd}{BRD}{bycatch reduction device} -\newacronym{bsai}{BS\slash AI}{Bering Sea\slash Aleutian Islands} -\newacronym{bsia}{BSIA}{best scientific information available} -\newacronym{btca}{BTCA}{Bottom Trawl Closed Area} -\newacronym{cands}{C\&S}{ceremonial and subsistence} -\newacronym{caal}{CAAL}{conditional age-at-length} -\newacronym{calcofi}{CalCOFI}{California Cooperative Oceanic Fisheries Investigations} -\newacronym{calpoly}{Cal Poly}{California Polytechnic State University} -\newacronym{cbnms}{CBNMS}{Cordell Bank National Marine Sanctuary} -\newacronym{calcom}{CalCOM}{CalCOM database for the California Cooperative Survey} -\newacronym{cca}{CCA}{Cowcod Conservation Area} -\newacronym{cce}{CCE}{California Current Ecosystem} -\newacronym{cdfw}{CDFW}{California Department of Fish and Wildlife} -\newacronym{cesu}{CESU}{Cooperative Ecosystem Studies Unit} -\newacronym{cinms}{CINMS}{Channel Islands National Marine Sanctuary} -\newacronym{cfmc}{CFMC}{Caribbean Fisheries Management Council} -\newacronym{cfr}{CFR}{Code of Federal Regulations} -\newacronym{ci}{CI}{Cooperative Institute} -\newacronym{cie}{CIE}{Center for Independent Experts} -\newacronym{cmsp}{CMSP}{Coastal and Marine Spatial Planning} -\newacronym{copc}{\href{http://www.opc.ca.gov/}{COPC}}{\href{http://www.opc.ca.gov/}{California Ocean Protection Council}} -\newacronym{covid}{COVID-19}{Coronavirus disease} -\newacronym{cp}{CP}{catcher-processor} -\newacronym{cpfv}{CPFV}{commercial passenger fishing vessel} -\newacronym{cps}{CPS}{coastal pelagic species} -\newacronym{cpue}{CPUE}{catch per unit effort} -\newacronym{crca}{CRCA}{California Rockfish Conservation Area} -\newacronym{crfs}{CRFS}{California Recreational Fisheries Survey} -\newacronym{csmp}{CSMP}{California Seafloor Mapping Program} -\newacronym{csp}{CSP}{Halibut Catch Sharing Plan} -\newacronym{csumb}{\href{http://seafloor.otterlabs.org/}{CSUMB}}{\href{http://seafloor.otterlabs.org/}{California State University at Monterey Bay Seafloor Mapping Lab}} -\newacronym{cv}{CV}{catcher vessel} -\newacronym{cwa}{CWA}{Clean Water Act} -\newacronym{czma}{CZMA}{Coastal Zone Management Act} -\newacronym{di}{D\&I}{Diversity and Inclusion} -\newacronym{dah}{DAH}{domestic annual harvest} -\newacronym{dap}{DAP}{domestic annual processing} -\newacronym{dfo}{DFO}{Fisheries and Oceans Canada} -\newacronym{doc}{DOC}{Department of Commerce} -\newacronym{doi}{DOI}{Department of Interior} -\newacronym{dscs}{DSCD}{deep sea coral and sponge} -\newacronym{dtl}{DTL}{daily trip limit} -\newacronym{dts}{DTS}{dover sole, thornyhead, and trawl-caught sablefish complex} -\newacronym{dw}{DW}{disk width} -\newacronym{eas}{EAS}{Ecosystem Advisory Subpanel} -\newacronym{ebm}{EBM}{ecosystem-based management} -\newacronym{ebfm}{EBFM}{ecosystem-based fisheries management} -\newacronym{ebs}{EBS}{Eastern Bering Sea} -\newacronym{ec}{EC}{ecosystem component} -\newacronym{eeop}{EEOP}{Equal Employment Opportunity Plan} -\newacronym{eez}{EEZ}{exclusive economic zone} -\newacronym{efh}{EFH}{essential fish habitat} -\newacronym{efhca}{EFHCA}{essential fish habitat conservation area} -\newacronym{efin}{EFIN}{Economic Fishery Information Network} -\newacronym{efp}{EFP}{exempted fishing permit} -\newacronym{eis}{EIS}{Environmental Impact Statement} -\newacronym{eli}{ELI}{Ecosystem Linkage Index} -\newacronym{em}{EM}{electronic monitoring} -\newacronym{emer}{EM\slash ER}{Electronic Monitoring\slash Electronic Reporting} -\newacronym{enso}{ENSO}{El Ni{\~n}o Southern Oscillation} -\newacronym{epp}{EPP}{Educational Partnership Program} -\newacronym{esa}{ESA}{Endangered Species Act} -\newacronym{esu}{ESU}{evolutionary significant unit} -\newacronym{fep}{FEP}{Fishery Ecosystem Plan} -\newacronym{fis}{FIS}{Fisheries Information System} -\newacronym{fl}{FL}{fork length} -\newacronym{fmp}{FMP}{Fishery Management Plan} -\newacronym{fmsy}{$F_{MSY}$}{fishing mortality at maximum sustainable yield} -\newacronym{fmu}{FMU}{Fishery Management Unit} -\newacronym{foia}{FOIA}{Freedom of Information Act} -\newacronym{fram}{FRAM}{Fishery Resource and Monitoring Division} -\newacronym{fssi}{FSSI}{Fish Stock Sustainability Index} -\newacronym{fws}{FWS}{U.S. Fish and Wildlife Service} -\newacronym{gap}{GAP}{Groundfish Advisory Subpanel} -\newacronym{garfo}{GARFO}{Greater Atlantic Regional Fisheries Office} -\newacronym{gca}{GCA}{Groundfish Conservation Area} -\newacronym{gdp}{GDP}{gross domestic product} -\newacronym{gemm}{GEMM}{Groundfish Expanded Mortality Multi-Year} -\newacronym{gfa}{GFA}{groundfish fishing area} -\newacronym{gfnms}{GFNMS}{Gulf of the Farallones National Marine Sanctuary} -\newacronym{gis}{GIS}{Geographic Information System} -\newacronym{glm}{GLM}{Generalized Linear Model} -\newacronym{gmfmc}{GMFMC}{Gulf of Mexico Fishery Management Council} -\newacronym{gmt}{GMT}{Groundfish Management Team} -\newacronym{goa}{GOA}{Gulf of Alaska} -\newacronym{gps}{GPS}{Global Positioning System} -\newacronym{gsmfc}{GSMFC}{Gulf States Marine Fisheries Commission} -\newacronym{haip}{HAIP}{Habitat Assessment Improvement Plan} -\newacronym{hapc}{HAPC}{Habitat Area of Particular Concern} -\newacronym{hcr}{HCR}{harvest control rule} -\newacronym{hg}{HG}{harvest guideline} -\newacronym{hms}{HMS}{highly migratory species} -\newacronym{hsp}{HSP}{habitat suitability probability} -\newacronym{hud}{HUD}{Habitat Use Database} -\newacronym{iattc}{IATTC}{Inter-American Tropical Tuna Commission} -\newacronym{ibq}{IBQ}{individual bycatch quota} -\newacronym{idfg}{IDFG}{Idaho Department of Fish and Game} -\newacronym{iea}{IEA}{Integrated Ecosystem Assessment} -\newacronym{ifq}{IFQ}{individual fishing quota} -\newacronym{inpfc}{INPFC}{International North Pacific Fishery Commission} -\newacronym{iphc}{IPHC}{International Pacific Halibut Commission} -\newacronym{iq}{IQ}{individual quota} -\newacronym{isw}{ISW}{interspiracular width} -\newacronym{itq}{ITQ}{individual transferable or tradeable quota} -\newacronym{iuu}{IUU}{illegal, unregulated, and unreported} -\newacronym{jv}{JV}{joint-venture} -\newacronym{jvp}{JVP}{joint-venture processing} -\newacronym{lapp}{LAPP}{Limited Access Privilege Program} -\newacronym{le}{LE}{limited entry} -\newacronym{lmrcsc}{LMRCSC}{Living Marine Resources Cooperative Science Center} -\newacronym{mafmc}{MAFMC}{Mid-Atlantic Fishery Management Council} -\newacronym{marmap}{MARMAP}{Marine Resource Monitoring and Assessment Program} -\newacronym{marpol}{MARPOL}{International Convention for the Prevention of Pollution from Ships} -\newacronym{mbnms}{MBNMS}{Monterey Bay National Marine Sanctuary} -\newacronym{mbta}{MBTA}{Migratory Bird Treaty Act} -\newacronym{mfmt}{MFMT}{maximum fishing mortality threshold} -\newacronym{mlr}{MLR}{minimum landing requirement} -\newacronym{mle}{MLE}{maximum likelihood estimation} -\newacronym{mlml}{\href{https://www.mlml.calstate.edu/}{MLML}}{\href{https://www.mlml.calstate.edu/}{Moss Landing Marine Laboratories}} -\newacronym{mlpa}{MLPA}{California Marine Life Protection Act} -\newacronym{mmpa}{MMPA}{Marine Mammal Protection Act} -\newacronym{moa}{MOA}{Memorandum of Agreement} -\newacronym{mou}{MOU}{Memorandum of Understanding} -\newacronym{mpa}{MPA}{Marine Protected Area} -\newacronym{mrfss}{MRFSS}{Marine Recreational Fisheries Statistics Survey} -\newacronym{mrep}{MREP}{Marine Resource Education Program} -\newacronym{mrip}{MRIP}{Marine Recreation Information Program} -\newacronym{ms}{MS}{mothership} -\newacronym{mse}{MSE}{management strategy evaluation} -\newacronym{msfcma}{MSFCMA}{Magnuson-Stevens Fishery Conservation and Management Act} -\newacronym{msi}{MSI}{Minority Serving Institution} -\newacronym{msra}{MSRA}{Magnuson-Stevens Fishery Conservation and Management Reauthorization Act of 2006} -\newacronym{msst}{MSST}{minimum stock size threshold} -\newacronym{msy}{\emph{MSY}}{maximum sustainable yield} -\newacronym{n-fish}{N-FISH}{National Marine Fisheries Service Diversity Intern Program} -\newacronym{na}{NA}{not available} -\newacronym{namss}{\href{https://walrus.wr.usgs.gov/namss/}{NAMSS}}{\href{https://walrus.wr.usgs.gov/namss/}{United States Geological Survey National Archive of Marine Seismic Surveys}} -\newacronym{ncss}{NCSS}{National Climate Science Strategy} -\newacronym{neamap}{NEAMAP}{Northeast Area Monitoring and Assessment Program} -\newacronym{nefmc}{NEFMC}{New England Fishery Management Council} -\newacronym{nefsc}{NEFSC}{Northeast Fisheries Science Center} -\newacronym{nepa}{NEPA}{National Environmental Policy Act} -\newacronym{ngsa}{NGSA}{Next Generation Stock Assessment} -\newacronym{nm}{nm}{nautical mile} -\newacronym{nmfs}{NMFS}{National Marine Fisheries Service} -\newacronym{nms}{NMS}{National Marine Sanctuary} -\newacronym{nmsa}{NMSA}{National Marine Sanctuaries Act} -\newacronym{noaa}{\href{https://www.noaa.gov/}{NOAA}}{\href{https://www.noaa.gov/}{National Oceanic \& Atmospheric Administration}} -\newacronym{noaagc}{NOAA GC}{National Oceanic \& Atmospheric Administration General Counsel} -\newacronym{noi}{NOI}{notice of intent} -\newacronym{norpac}{NORPAC}{North Pacific Database Program} -\newacronym{nos}{NOS}{National Ocean Service} -\newacronym{npfmc}{NPFMC}{North Pacific Fishery Management Council} -\newacronym{npoa}{NPOA}{National Plan of Action} -\newacronym{nrc}{NRC}{National Research Council} -\newacronym{nrcc}{NRCC}{Northeast Regional Coordinating Council} -\newacronym{nrdc}{NRDC}{Natural Resources Defense Council} -\newacronym{ns1}{NS1}{National Standard 1} -\newacronym{nsf}{NSF}{National Science Foundation} -\newacronym{nsg}{NSG}{National Standards guidelines} -\newacronym{nwfsc}{NWFSC}{Northwest Fisheries Science Center} -\newacronym{nwifc}{NWIFC}{Northwest Indian Fisheries Commission} -\newacronym{nwr}{NWR}{Northwest Region} -\newacronym{oa}{OA}{open access} -\newacronym{oaq}{OAQ}{Office of Aquaculture} -\newacronym{ocnms}{OCNMS}{Olympic Coast National Marine Sanctuary} -\newacronym{odfw}{ODFW}{Oregon Department of Fish and Wildlife} -\newacronym{ofl}{OFL}{overfishing limit} -\newacronym{opm}{OPM}{Office of Personnel Management} -\newacronym{orbs}{ORBS}{Oregon Department of Fish and Wildlife Oregon Recreational Boat Survey} -\newacronym{osp}{OSP}{Washington Department of Fish and Wildlife Ocean Sampling Program} -\newacronym{oy}{OY}{optimum yield} -\newacronym{pacfin}{PacFIN}{Pacific Fisheries Information Network} -\newacronym{pbr}{PBR}{Potential Biological Removal} -\newacronym{pcffa}{PCFFA}{Pacific Coast Federation of Fishermen's Associations} -\newacronym{pcmsc}{\href{https://www.usgs.gov/centers/pcmsc}{PCMSC}}{\href{https://www.usgs.gov/centers/pcmsc}{Pacific Coastal and Marine Science Center}} -\newacronym{pdf}{PDF}{probability density function} -\newacronym{pdo}{PDO}{Pacific Decadal Oscillation} -\newacronym{pep}{PEP}{Woods Hole Partnership Education Program} -\newacronym{pfmc}{PFMC}{Pacific Fishery Management Council} -\newacronym{pifsc}{PIFSC}{Pacific Islands Fisheries Science Center} -\newacronym{piro}{PIRO}{Pacific Islands Regional Office} -\newacronym{pnw}{PNW}{Pacific Northwest} -\newacronym{pra}{PRA}{Paperwork Reduction Act} -\newacronym{prsaip}{PRSAIP}{Protected Resources Stock Assessment Improvement Plan} -\newacronym{psmfc}{PSMFC}{Pacific States Marine Fisheries Commission} -\newacronym{qaqc}{QA\slash QC}{Quality Assurance\slash Quality Control} -\newacronym{qp}{QP}{quota pounds} -\newacronym{qs}{QS}{quota shares} -\newacronym{quest}{QUEST}{Quantitative Ecology and Socioeconomics Training Program} -\newacronym{raq}{RAQ}{Regional Aquaculture Coordinator} -\newacronym{rca}{RCA}{Rockfish Conservation Area} -\newacronym{recfin}{RecFIN}{Recreational Fishery Information Network} -\newacronym{rer}{RER}{Recovery Exploitation Rate} -\newacronym{rfmo}{RFMO}{Regional Fishery Management Organization} -\newacronym{rir}{RIR}{Regulatory Impact Review} -\newacronym{rov}{ROV}{remote operated vehicle} -\newacronym{rtr}{RTR}{Research Training and Recruitment} -\newacronym{s-aslope}{Slope Survey}{Alaska Fisheries Science Center Slope Survey} -\newacronym{s-ccfrp}{\href{https://www.mlml.calstate.edu/ccfrp/}{CCFRP}}{\href{https://www.mlml.calstate.edu/ccfrp/}{California Collaborative Fisheries Research Program}} -\newacronym{s-nshelf}{NWFSC Shelf Survey}{Northwest Fisheries Science Center Shelf Survey} -\newacronym{s-nslope}{NWFSC Slope Survey}{Northwest Fisheries Science Center Slope Survey} -\newacronym{s-tri}{Triennial Survey}{Alaska Fisheries Science Center/Northwest Fisheries Science Center West Coast Triennial Shelf Survey} -\newacronym{s-wcgbt}{WCGBTS}{Northwest Fisheries Science Center West Coast Groundfish Bottom Trawl Survey} -\newacronym{s-hkl}{Hook and Line Survey}{Northwest Fisheries Science Center Hook and Line Survey} -\newacronym{safe}{SAFE}{Stock Assessment and Fishery Evaluation} -\newacronym{safmc}{SAFMC}{South Atlantic Fishery Management Council} -\newacronym{saip}{SAIP}{Stock Assessment Improvement Plan} -\newacronym{sam}{SAM}{State-Space Assessment Model} -\newacronym{sawsarc}{SAW\slash SARC}{Stock Assessment Workshop\slash Stock Assessment Review Committee} -\newacronym{sb}{SB}{spawning biomass} -\newacronym{ssb}{SB}{spawning biomass} -\newacronym{scaa}{SCAA}{Statistical Catch-at-Age Assessment} -\newacronym{sdc}{SDC}{status determination criteria} -\newacronym{sdmtmb}{\texttt{sdmTMB}}{\href{https://github.com/pbs-assess/sdmtmb}{Species Distribution Models with Template Model Builder}} -\newacronym{sebs}{SEBS}{Shore and Estuary Boat Survey, Oregon Department of Fish and Wildlife} -\newacronym{sec}{Secretary}{United States Secretary of Commerce} -\newacronym{sedar}{SEDAR}{Southeast Data, Assessment, and Review} -\newacronym{sefis}{SEFIS}{Southeast Fishery Independent Survey} -\newacronym{sefsc}{SEFSC}{Southeast Fisheries Science Center} -\newacronym{sero}{SERO}{Southeast Regional Office} -\newacronym{sfa}{SFA}{Sustainable Fisheries Act of 1996} -\newacronym{ses}{SES}{social--ecological system} -\newacronym{sia}{SIA}{Social Impact Analysis} -\newacronym{spr}{SPR}{spawning potential ratio} -\newacronym{ssc}{SSC}{Scientific and Statistical Committee} -\newacronym{sst}{SST}{sea-surface temperature} -\newacronym{star}{STAR}{Stock Assessment Review} -\newacronym{ss3}{SS3}{Stock Synthesis} -\newacronym{swfsc}{SWFSC}{Southwest Fisheries Science Center} -\newacronym{tac}{TAC}{total allowable catch} -\newacronym{tl}{TL}{total length} -\newacronym{tmb}{\href{https://kaskr.github.io/adcomp/index.html}{TMB}}{\href{https://kaskr.github.io/adcomp/index.html}{Template Model Builder}} -\newacronym{tnc}{TNC}{The Nature Conservancy} -\newacronym{tor}{ToR}{Terms of Reference} -\newacronym{ua}{U\&A}{usual and accustomed} -\newacronym{unols}{UNOLS}{University-National Oceanographic Laboratory System} -\newacronym{uscg}{USCG}{United States Coast Guard} -\newacronym{usfs}{USFS}{United States Forest Service} -\newacronym{usfws}{USFWS}{United States Fish and Wildlife Service} -\newacronym{usgs}{USGS}{United States Geological Survey} -\newacronym{vms}{VMS}{Vessel Monitoring System} -\newacronym{vast}{VAST}{vector autoregressive spatio-temporal} -\newacronym{wcgop}{WCGOP}{West Coast Groundfish Observer Program} -\newacronym{wcpfc}{WCPFC}{Western and Central Pacific Fisheries Commission} -\newacronym{wcr}{WCR}{West Coast Region} -\newacronym{wcspa}{WCSPA}{West Coast Seafood Processors Association} -\newacronym{wcvi}{WCVI}{West Coast Vancouver Island} -\newacronym{wdfw}{WDFW}{Washington Department of Fish and Wildlife} -\newacronym{wfmo}{WFMO}{Workforce Management Office} -\newacronym{wfoa}{WFOA}{Western Fishboat Owners Association} -\newacronym{wpfmc}{WPFMC}{Western Pacific Fishery Management Council} -\newacronym{wpsar}{WPSAR}{Western Pacific Stock Assessment Review} -\newacronym{yrca}{YRCA}{Yelloweye Rockfish Conservation Area} -\newacronym{yoy}{YOY}{young of the year} - diff --git a/inst/templates/skeleton/data.qmd b/inst/templates/skeleton/data.qmd deleted file mode 100644 index 208bd248..00000000 --- a/inst/templates/skeleton/data.qmd +++ /dev/null @@ -1,14 +0,0 @@ -## Data {#sec-data} - - diff --git a/inst/templates/skeleton/discussion.qmd b/inst/templates/skeleton/discussion.qmd deleted file mode 100644 index d10684ab..00000000 --- a/inst/templates/skeleton/discussion.qmd +++ /dev/null @@ -1,5 +0,0 @@ -## Discussion {#sec-discussion} - - diff --git a/inst/templates/skeleton/executive_summary.qmd b/inst/templates/skeleton/executive_summary.qmd deleted file mode 100644 index f6cd6695..00000000 --- a/inst/templates/skeleton/executive_summary.qmd +++ /dev/null @@ -1,24 +0,0 @@ -## Executive Summary {#sec-executive-summary} - - - -### Assessment Methods {#sec-assessment-methods} - - - -### Stock Status {#sec-stock-status} - - - - - diff --git a/inst/templates/skeleton/introduction.qmd b/inst/templates/skeleton/introduction.qmd deleted file mode 100644 index aa9f28ac..00000000 --- a/inst/templates/skeleton/introduction.qmd +++ /dev/null @@ -1,29 +0,0 @@ -## Introduction {#sec-introduction} - -Testing adding in an introduction for `r params$species`. There is currently no read of parameters for child documents. - -### Management and Assessment History {#sec-history} - - - -### Stock Structure and ID {#sec-stock-id} - - - -### Fishery Descriptions {#sec-fishery-desscriptions} - - - -### Ecosystem Considerations or climate indicators {#sec-eco-indicators} - - - diff --git a/inst/templates/skeleton/modeling_approach.qmd b/inst/templates/skeleton/modeling_approach.qmd deleted file mode 100644 index cfaaae74..00000000 --- a/inst/templates/skeleton/modeling_approach.qmd +++ /dev/null @@ -1,47 +0,0 @@ -## Modeling Approach {#sec-modeling-approach} - -### Current Approach {#sec-current-approach} - - - -### Configuration {#sec-configuration} - - - -### Sensitivity Analyses {#sec-model-sensitivity-analyses} - - - -### Management Benchmarks {#sec-management-benchmarks} - - - -### Diagnostics {#sec-diagnostics} - - - -### Projection Scenarios {#sec-projection-scenarios} - - diff --git a/inst/templates/skeleton/projections.qmd b/inst/templates/skeleton/projections.qmd deleted file mode 100644 index c1966c93..00000000 --- a/inst/templates/skeleton/projections.qmd +++ /dev/null @@ -1,5 +0,0 @@ -## Projections {#sec-projections} - - diff --git a/inst/templates/skeleton/results.qmd b/inst/templates/skeleton/results.qmd deleted file mode 100644 index d7a81e3c..00000000 --- a/inst/templates/skeleton/results.qmd +++ /dev/null @@ -1,43 +0,0 @@ -## Results {#sec-results} - -### Parameter Estimates {#sec-parameter-estimates} - - - -### Recruitment Estimates and Deviations {#recruitment-estimates} - - - -### Model Fits {#sec-model-fits} - - - -### Model Diagnostics {#sec-model-diagnostics} - - - -### Sensitivity Analysis {#sec-res-sensitivity-analyses} - - - - diff --git a/tests/testthat/test-add_section.R b/tests/testthat/test-add_section.R index c6675c6b..17489434 100644 --- a/tests/testthat/test-add_section.R +++ b/tests/testthat/test-add_section.R @@ -1,35 +1,48 @@ test_that("Adding new sections works.", { - sec_list <- add_base_section(c("introduction", "modeling approach", "results", "discussion")) + sec_list <- add_base_section(c("introduction", "assessment", "discussion")) sections <- add_section( - sec_names = c("abstract", "ecosystem_considerations", "alt_models"), - location = c("before-introduction", "after-discussion", "after-model"), - other_sections = sec_list, + new_section = c("abstract", "ecosystem_considerations", "alt_models"), + section_location = c("before-introduction", "after-discussion", "after-assessment"), + custom_sections = sec_list, subdir = tempdir() ) exp_list <- list( "abstract.qmd", - "introduction.qmd", - "modeling_approach.qmd", + "02_introduction.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_assessment-benchmarks.qmd", + "04e_assessment-projections.qmd", "alt_models.qmd", - "results.qmd", - "discussion.qmd", + "05_discussion.qmd", "ecosystem_considerations.qmd" ) expect_equal(sections, exp_list) }) test_that("Adding new sections does not work.", { - sec_list <- add_base_section(c("introduction", "data", "modeling approach", "acknowledgments", "appendix", "references")) + sec_list <- add_base_section(c("introduction", "data", "assessment", "acknowledgments", "appendix", "references")) sections <- add_section( - sec_names = c("Harvest Control Rules", "Regional Management Considerations", "Research and Data Needs"), - location = c("after-model", "after-model", "after-model"), - other_sections = sec_list, + new_section = c("Harvest Control Rules", "Regional Management Considerations", "Research and Data Needs"), + section_location = c("after-assessment", "after-assessment", "after-assessment"), + custom_sections = sec_list, subdir = tempdir() ) exp_list <- list( - "introduction.qmd", "data.qmd", "modeling_approach.qmd", "Harvest_Control_Rules.qmd", - "Regional_Management_Considerations.qmd", "Research_and_Data_Needs.qmd", - "acknowledgments.qmd", "appendix.qmd", "references.qmd" + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_assessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "harvest_control_rules.qmd", + "regional_management_considerations.qmd", + "research_and_data_needs.qmd", + "06_acknowledgments.qmd", + "11_appendix.qmd", + "07_references.qmd" ) expect_equal(sections, exp_list) }) diff --git a/tests/testthat/test-create_template.R b/tests/testthat/test-create_template.R index dfaa07f0..7f07cc2e 100644 --- a/tests/testthat/test-create_template.R +++ b/tests/testthat/test-create_template.R @@ -1,20 +1,22 @@ test_that("Can trace template files from package", { path <- system.file("templates", "skeleton", package = "asar") base_temp_files <- c( - "acknowledgments.qmd", - "appendix.qmd", - "assessment_glossaries.tex", - "data.qmd", - "discussion.qmd", - "executive_summary.qmd", - # "figures.qmd", + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_assessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "10_notes.qmd", + "11_appendix.qmd" + # "09_figures.qmd", # "in-header.tex", - "introduction.qmd", - "modeling_approach.qmd", - "projections.qmd", - "references.qmd", - "results.qmd" - # "tables.qmd", + # "08_tables.qmd", # "title.tex" ) expect_equal(list.files(path), base_temp_files) @@ -23,22 +25,24 @@ test_that("Can trace template files from package", { test_that("create_template() creates correct files", { # Define expected report files expect_report_files <- c( - "acknowledgments.qmd", - "appendix.qmd", - "assessment_glossaries.tex", - "data.qmd", - "discussion.qmd", - "executive_summary.qmd", - "figures.qmd", - "introduction.qmd", - "modeling_approach.qmd", - "projections.qmd", - "references.qmd", - "results.qmd", + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_assessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd", "SAR_species_skeleton.qmd", - "support_files", - "tables.qmd" - ) + "support_files" + ) # Define expected support files expect_support_files <- c( @@ -57,7 +61,8 @@ test_that("create_template() creates correct files", { object_report_files <- list.files(no_inputs_output_path) object_support_files <- list.files(file.path(no_inputs_output_path, "support_files")) - on.exit(unlink(file.path(path, "stock_assessment_reports"), recursive = TRUE), add = TRUE) + on.exit(unlink(file.path(path, "stock_assessment_reports"), + recursive = TRUE), add = TRUE) # Check if all expected report files are created expect_true(all(sort(expect_report_files) == sort(object_report_files))) @@ -79,7 +84,7 @@ test_that("create_template() creates correct files", { author = c("John Snow", "Danny Phantom", "Patrick Star"), include_affiliation = TRUE, parameters = FALSE, - resdir = NULL, + resdir = "data", model_results = "Report.sso", model = "SS3" ) @@ -91,21 +96,23 @@ test_that("create_template() creates correct files", { on.exit(unlink(file.path(path, "stock_assessment_reports"), recursive = TRUE), add = TRUE) # Define expected report files for Dover sole expect_report_files <- c( - "acknowledgments.qmd", - "appendix.qmd", - "assessment_glossaries.tex", - "data.qmd", - "discussion.qmd", - "executive_summary.qmd", - "figures.qmd", - "introduction.qmd", - "modeling_approach.qmd", - "projections.qmd", - "references.qmd", - "results.qmd", + "01_executive_summary.qmd", + "02_introduction.qmd", + "03_data.qmd", + "04a_assessment-configuration.qmd", + "04b_assessment-results.qmd", + "04c_assessment-sensitivity.qmd", + "04d_assessment-benchmarks.qmd", + "04e_assessment-projections.qmd", + "05_discussion.qmd", + "06_acknowledgments.qmd", + "07_references.qmd", + "08_tables.qmd", + "09_figures.qmd", + "10_notes.qmd", + "11_appendix.qmd", "SAR_Dover_sole_skeleton.qmd", - "support_files", - "tables.qmd" + "support_files" ) # Define expected support files for Dover sole expect_dover_sole_support_files <- c( @@ -142,7 +149,8 @@ test_that("warning is triggered for missing models", { ), regexp = "Results file or model name not defined." ) - on.exit(unlink(file.path(getwd(), "stock_assessment_reports"), recursive = TRUE), add = TRUE) + on.exit(unlink(file.path(getwd(), "stock_assessment_reports"), + recursive = TRUE), add = TRUE) }) test_that("warning is triggered for existing files", { @@ -156,7 +164,7 @@ test_that("warning is triggered for existing files", { author = c("John Snow", "Danny Phantom", "Patrick Star"), include_affiliation = TRUE, parameters = FALSE, - resdir = NULL, + resdir = "data", model_results = "Report.sso", model = "SS3" ) @@ -179,7 +187,7 @@ test_that("warning is triggered for existing files", { author = c("John Snow", "Danny Phantom", "Patrick Star"), include_affiliation = TRUE, parameters = FALSE, - resdir = NULL, + resdir = "data", model_results = "Report.sso", model = "SS3" ), @@ -210,7 +218,7 @@ test_that("file_dir works", { author = c("John Snow", "Danny Phantom", "Patrick Star"), include_affiliation = TRUE, parameters = FALSE, - resdir = NULL, + resdir = "data", model_results = "Report.sso", model = "SS3", file_dir = dir @@ -218,5 +226,8 @@ test_that("file_dir works", { file_path <- file.path(dir, "stock_assessment_reports", office, species, year) expect_gt(length(list.files(file_path)), 1) + + expect_gte(length(list.files(dir)), 1) + on.exit(unlink(dir, recursive = TRUE), add = TRUE) })