Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release for v0.3 #82

Draft
wants to merge 96 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
6979639
Attempt to inherit custom_sections parameter from asar::create_templa…
sbreitbart-NOAA Oct 1, 2024
d209fcb
Changed remaining x's (former argument) into custom_sections (new arg…
sbreitbart-NOAA Oct 1, 2024
d7a4199
Clarified argument definitions for add_child.R
sbreitbart-NOAA Oct 1, 2024
52d7823
Clarified argument definitions for add_chunk.R
sbreitbart-NOAA Oct 1, 2024
65881f1
Clarified argument definitions for add_section.R.
sbreitbart-NOAA Oct 2, 2024
24fd9b0
Clarified argument definitions for create_citation.R
sbreitbart-NOAA Oct 2, 2024
6dc9c07
Clarified argument definitions for create_figures_doc.R
sbreitbart-NOAA Oct 2, 2024
4fa0e9c
Clarified argument definitions for create_title.R
sbreitbart-NOAA Oct 2, 2024
30c9511
Clarified argument definitions for export_object.R
sbreitbart-NOAA Oct 2, 2024
b274cc2
Clarified argument definitions for format_quarto.R
sbreitbart-NOAA Oct 2, 2024
eb7186b
Clarified argument definitions in create_template. Since associated s…
sbreitbart-NOAA Oct 4, 2024
4bf4460
Updated documentation
sbreitbart-NOAA Oct 4, 2024
6193006
Clarified argument definitions in convert_output.R and updated docume…
sbreitbart-NOAA Oct 4, 2024
d5e96a6
Update(affiliation_info.csv): add country
Schiano-NOAA Oct 8, 2024
d64bca5
update(create_figures_doc): add example of where caption will go
Schiano-NOAA Oct 8, 2024
6704d41
Reorder skeleton (#59)
sbreitbart-NOAA Oct 16, 2024
0353fe0
Updating ss3 variable names Excel file by highlighting variables that…
sbreitbart-NOAA Oct 16, 2024
46f3c61
fix: adjustments to pass checks/ghactions
Schiano-NOAA Oct 16, 2024
e4ce531
fix(std naming&convert_output): make changes to standard naming sheet…
Schiano-NOAA Oct 17, 2024
cc06cf5
Update(wordlist): issues with spelling and names for species fixed
Schiano-NOAA Oct 17, 2024
8ffb58f
feat(README): change example to petrale
Schiano-NOAA Oct 1, 2024
15caf0d
update(example): change README so users can run petrale example
Schiano-NOAA Oct 10, 2024
797afbb
fix:(create_template): add preamble
Schiano-NOAA Oct 10, 2024
1d6f65b
update(test-add_chunk): correct notes in test
Schiano-NOAA Oct 10, 2024
b97c904
Fix(readme): example needed csv file
Schiano-NOAA Oct 10, 2024
3415979
Update(readme): adjust for new section names
Schiano-NOAA Oct 11, 2024
e5030c2
update(website): change set up of pkgdown website
Schiano-NOAA Oct 11, 2024
d438d19
Update(pkgdown.yml): include tutorial
Schiano-NOAA Oct 15, 2024
53675d7
feature(add tutorial): demo in shiny app
Schiano-NOAA Oct 15, 2024
45d030b
remove(tutorial): move materials to asar-demo repo and host there
Schiano-NOAA Oct 17, 2024
6799b4f
update(pkgdown): add tutorial link to site
Schiano-NOAA Oct 17, 2024
7a8401d
update(README): add link for tutorial in examples
Schiano-NOAA Oct 17, 2024
963a84a
add(species images): more images for title page
Schiano-NOAA Oct 18, 2024
781000d
feature(create_template): add output R chunk and space for bib file
Schiano-NOAA Oct 18, 2024
de7d2b6
fix: fixed small typo
sbreitbart-NOAA Oct 18, 2024
14c2cb1
Add in bib_file arg
Schiano-NOAA Oct 18, 2024
bc2bebf
add(spp_images): hawaiian big7 species images
Schiano-NOAA Oct 21, 2024
0761b18
update(create_figures_doc): add in chunk options for cap and alt text
Schiano-NOAA Oct 22, 2024
c9b90b9
Make adjustments to BAM names
Schiano-NOAA Oct 22, 2024
0c651b9
fix(references): method so .bib file is read in with the quarto file …
Schiano-NOAA Oct 22, 2024
f1db7d4
uncomment the add_chunk() tests (#63)
Bai-Li-NOAA Oct 22, 2024
f081083
update: decription and create_template documentation
Schiano-NOAA Oct 22, 2024
a0a6fd7
Merge branch 'dev' of https://github.com/nmfs-ost/asar into dev
Schiano-NOAA Oct 22, 2024
078dfc3
fix(create_template): replace example with previous one developed by …
Schiano-NOAA Oct 22, 2024
7db539e
build: started building functionality to add captions and alt text to…
sbreitbart-NOAA Oct 22, 2024
890a0c9
build: developed capability to caption tables.
sbreitbart-NOAA Oct 22, 2024
f9873d7
Update(pkgdown yml): Reorder top nav bar and have a drop down manual …
Schiano-NOAA Oct 24, 2024
aec0b23
Merge branch 'dev' into asar-example
Schiano-NOAA Oct 24, 2024
a2caef7
Remove example data - moved to asar-demo
Schiano-NOAA Oct 24, 2024
f0ee977
Merge branch 'asar-example' of https://github.com/nmfs-ost/asar into …
Schiano-NOAA Oct 24, 2024
d6fcf1f
Create working example and resources for users (#54)
Schiano-NOAA Oct 24, 2024
3b193bb
build: created first outline and basic files for new accessibility vi…
sbreitbart-NOAA Oct 24, 2024
f0d7033
fix(author order): add line so order of authors follows that input by…
Schiano-NOAA Oct 24, 2024
1dd0996
Merge branch 'dev' of https://github.com/nmfs-ost/asar into dev
Schiano-NOAA Oct 24, 2024
bfd0f46
Update(WORDLIST)
Schiano-NOAA Oct 24, 2024
8ddc2d8
feature(_titlepage); add dynamic alt text to cover image
Schiano-NOAA Oct 25, 2024
e0c09ce
feature(create_tempalte): change pdf engine to lualatex when format i…
Schiano-NOAA Oct 25, 2024
01a9ce7
Update(tex): documentation
Schiano-NOAA Oct 25, 2024
db44baf
feature(create_template): add quanitites to preamble chunk
Schiano-NOAA Oct 25, 2024
2b2e38b
update(create_template): reflect changes to create_titlepage_tex in fxn
Schiano-NOAA Oct 25, 2024
8eeda1a
build: finished first full draft of accessibility vignette
sbreitbart-NOAA Oct 25, 2024
9e9c276
Merge branch 'dev' into pkgdown-vignettes
Schiano-NOAA Oct 25, 2024
e262af8
build: adding some files associated with building the accessibility v…
sbreitbart-NOAA Oct 25, 2024
159c1db
fix(create_template): reference to converted output correction
Schiano-NOAA Oct 25, 2024
e22017f
Merge branch 'dev' of https://github.com/nmfs-ost/asar into dev
Schiano-NOAA Oct 25, 2024
9095b1f
Merge pull request #65 from nmfs-ost/pkgdown-vignettes
sbreitbart-NOAA Oct 25, 2024
031533d
Revert "Pkgdown vignettes"
sbreitbart-NOAA Oct 25, 2024
886ec55
Merge pull request #66 from nmfs-ost/revert-65-pkgdown-vignettes
sbreitbart-NOAA Oct 25, 2024
95a597b
fix: to resolve call-workflow / spell-check error, added words to the…
sbreitbart-NOAA Oct 28, 2024
9433635
fix(site): remove unncessary folders and files
Schiano-NOAA Oct 28, 2024
41032d6
Update(description): authorship
Schiano-NOAA Oct 28, 2024
899f0a6
fix(description): authorship structure
Schiano-NOAA Oct 28, 2024
5e3bf89
Fix description...again
Schiano-NOAA Oct 28, 2024
9ee17b0
Update(authorship)
Schiano-NOAA Oct 29, 2024
d34ba74
build: added alt text to cover page's US Dept of Commerce seal
sbreitbart-NOAA Oct 29, 2024
ad24bd2
fix: Changed the NOAA logo classification to an artifact and removed …
sbreitbart-NOAA Oct 29, 2024
26bed8b
Fix(create_template): change save for convert_output to remove extra …
Schiano-NOAA Nov 1, 2024
0680e4c
Merge pull request #68 from nmfs-ost/alt-text-noaa-logo
sbreitbart-NOAA Nov 4, 2024
97aa1b3
fix(create_template.R): updated definition of model_results argument.
sbreitbart-NOAA Nov 6, 2024
56f5787
Automatically identify fleet names in BAM output (#72)
Schiano-NOAA Nov 7, 2024
639ebba
style(create_template): shortened chunk labels by removing preceding …
sbreitbart-NOAA Nov 7, 2024
26d4eef
Merge pull request #74 from nmfs-ost/shorten-labels
sbreitbart-NOAA Nov 7, 2024
a6c82e8
fix: updated syntax for cover USDC logo. It should contain no alt tex…
sbreitbart-NOAA Nov 12, 2024
b955993
Merge pull request #78 from nmfs-ost/alt-text-noaa-logo
sbreitbart-NOAA Nov 12, 2024
ab7d74a
Create excel spreadsheet showing which accessibility-related criteria…
sbreitbart-NOAA Nov 15, 2024
5cf5e7b
Adding Ross' proposed changes to Latex files through comments
sbreitbart-NOAA Nov 18, 2024
8d55a62
Adding (more of) Ross' proposed changes to Latex files through comments
sbreitbart-NOAA Nov 18, 2024
00df75b
feature(add_chunk): new argument to add rmarkdown chunk options
Schiano-NOAA Nov 18, 2024
05dbd77
Update fxn documentation
Schiano-NOAA Nov 18, 2024
988cb95
fix(add_chunk): features to add Rmarkdown or quarto formatted options…
Schiano-NOAA Nov 20, 2024
8b050f6
Adding (even more of) Ross' proposed changes to Latex files through c…
sbreitbart-NOAA Nov 20, 2024
43d7f9e
Merge branch 'dev' of https://github.com/nmfs-ost/asar into compare-tex
sbreitbart-NOAA Nov 20, 2024
8974fb6
Enhanced accessibility vignette (incl. minor edits, added to-do list …
sbreitbart-NOAA Nov 21, 2024
86a78d4
updated labels to fig-__ and tbl-__ in create_figures/tables_docs; up…
sbreitbart-NOAA Nov 26, 2024
2d3e371
added FAQs vignette (placeholder)
sbreitbart-NOAA Nov 26, 2024
07afbf8
added new chunks for plot-generating fxns in create_figures_doc; chan…
sbreitbart-NOAA Nov 26, 2024
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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
^docs$
^pkgdown$
^\.github$
^doc$
^Meta$
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
.RData
.Ruserdata
*.Rproj

.DS_Store
/.quarto/
/_site/
docs
inst/doc
Report.sso
petrale_convert_output.csv
stock_assessment_reports
/doc/
/Meta/
captions_alt_text.csv
converted_file_1126.csv
46 changes: 40 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
Package: asar
Title: Build NOAA Stock Assessment Report
Version: 0.0.0.9000
Authors@R:
person("Samantha", "Schiano", , "samantha.schiano@noaa.gov", role = c("aut", "cre"),
comment = c(ORCID = "0009-0003-3744-6428"))
Authors@R: c(
person(
"Samantha", "Schiano",
email = "samantha.schiano@noaa.gov",
role = c("aut", "cre"),
comment = c(ORCID = "0009-0003-3744-6428")
),
person(
"Sophie", "Breitbart",
email = "sophie.breitbart@noaa.gov",
role = c("aut", "ctb"),
comment = c(ORCID = "0000-0001-9641-9786")
),
person(
"Steve", "Saul",
email = "steven.saul@noaa.gov",
role = c("aut", "ctb")
),
person("Kelli", "Johnson",
email = "kelli.johnson@noaa.gov",
role = c("ctb"),
comment = c(ORCID = "0000-0002-5149-451X")
),
person(
"Bai", "Li",
email = "bai.li@noaa.gov",
role = c("ctb"),
comment = c(ORCID = "0000-0002-8249-1442")
))
Description: Build a full or update stock assessment report for any stock
assessment model. Parameterization allows the user to call a template
based on their regional science center, species, area, ect.
Expand All @@ -15,13 +41,13 @@ Imports:
forstringr,
fs,
ggplot2,
glue,
gridExtra,
gt,
naniar,
nmfspalette,
officer,
openxlsx,
prodlim,
satf,
stats,
stringr,
svDialogs,
Expand All @@ -30,19 +56,27 @@ Imports:
tidyselect,
utils
Suggests:
gt,
kableExtra,
knitr,
parallel,
r4ss,
rmarkdown,
satf,
snowfall,
testthat (>= 3.0.0)
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
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends:
R (>= 2.10)
LazyData: true
14 changes: 7 additions & 7 deletions R/add_base_section.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#' Add selected sections to outline
#'
#' @param x inherited 'custom_sections' parameter from create_template
#' @inheritParams create_template
#'
#' @return Call and copy the sections in the package templates to create an outline for a stock assessment
#' @export
#'
#' @examples add_base_section(c("executive summary", "modeling approach", "results"))
add_base_section <- function(x) {
sec_sel <- gsub(" ", "_", tolower(gsub("(.)([A-Z])", "\\1 \\2", x)))
#' @examples add_base_section(c("executive summary", "assessment", "results"))
add_base_section <- function(custom_sections) {
sec_sel <- gsub(" ", "_", tolower(gsub("(.)([A-Z])", "\\1 \\2", custom_sections)))
section_list <- list()
for (i in 1:length(sec_sel)) {
sec_file <- grep(
x = 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))
}
4 changes: 2 additions & 2 deletions R/add_child.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Write R Chunk to Add Child Document
#'
#' @param x section .qmd file to add into the template, options for sections are in the 'skeleton' folder; only select XX_section.qmd files and not a, b, c... subfiles
#' @param label description for the child document being added (short - one/two words max)
#' @param x An additional section to add into the template. Options for additional sections are in the 'skeleton' folder. Appropriate files are .qmd files and are formatted as such: XX_section.qmd (i.e., not a, b, c... subfiles).
#' @param label Description of the child document being added. It should be short- one or two words, maximum.
#'
#' @return Formatting R chunk for child document to add section into the template/skeleton.
#' Utilize the cat() function to implement into readable text.
Expand Down
36 changes: 21 additions & 15 deletions R/add_chunk.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#' Write R chunk to template
#'
#' @param x content within the R chunk to be written contained inside quotation marks
#' @param label What to name the chunk in the 'label:' section of the r code chunk; should be in snakecase
#' @param echo repeat code into the document; default is false
#' @param warnings Report warnings into console during render? Default is false
#' @param eval Evaluate the chunk? default is true
#' @param add_option TRUE/FALSE add additional chunk options? default is FALSE
#' @param chunk_op list of chunk options to add; example: c("output: true", "error: false)
#' @param x Content to be written within the R chunk. Wrap in quotation marks ("").
#' @param label The name of the chunk in the 'label:' section of the R code chunk.
#' This should be in snakecase (i.e., in which words are written in lowercase and
#' connected by underscores).
#' @param echo TRUE/FALSE; Option to repeat code in the document. Default is false.
#' @param warnings TRUE/FALSE; Option to report warnings in the console during render.
#' Default is false.
#' @param eval TRUE/FALSE; Option to evaluate the chunk. Default is true.
#' @param add_option TRUE/FALSE; Option to add additional chunk options. Default is false.
#' @param chunk_op List of chunk options to add. For example: c("output: true", "error: false)
#' @param rmark_op List of chunk options to add after indicating the language of the chunk as used in Rmarkdown.
#'
#' @return Write an additional R chunk into the template using this function.
#' The code can be written as usual, just remember to put it entirely
Expand All @@ -21,9 +25,10 @@ add_chunk <- function(
eval = "true",
label = NULL,
add_option = FALSE,
chunk_op = NULL) {
chunk_op = NULL,
rmark_op = NULL) {
chunk <- paste0(
"```{r} \n"
"```{r", ifelse(add_option, paste0(c("",rmark_op), collapse = ", "), ""), "} \n"
)
if (!is.null(label)) {
chunk <- paste0(
Expand All @@ -36,12 +41,13 @@ add_chunk <- function(
chunk,
"#| echo: ", echo, " \n",
"#| warning: ", warnings, " \n",
"#| eval: ", eval, " \n"
"#| eval: ", eval, " \n",
ifelse(add_option & !is.null(chunk_op), paste0(paste0("#| ", chunk_op, collapse = " \n"), "\n"), "")
)
if (add_option == TRUE) {
for (i in 1:length(chunk_op)) {
chunk <- paste0(chunk, "#| ", chunk_op[i], " \n")
}
}
# if (add_option == TRUE) {
# for (i in 1:length(chunk_op)) {
# chunk <- paste0(chunk, "#| ", chunk_op[i], " \n")
# }
# }
paste0(chunk, x, "\n", "``` \n")
}
68 changes: 29 additions & 39 deletions R/add_section.R
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
#' Add New Section to Template
#' Add New Section or Subsection to Template
#'
#' @param sec_names section_names of the subsection. Please keep this short as the template
#' will be created as a quarto document into your skeleton and saved
#' later for reference. More than one section can be added. Please
#' make a list if this is desired.
#' @param location Where the section will be added in the generic template using
#' the notation of 'placement-section'. Example would be 'in-introduction'
#' where the new content would be created as a child document
#' and added into the 02_introduction.qmd. There is an option to
#' add more than one section. Add the location as a list
#' corresponding to the order of section names listed in the
#' 'title' parameter
#' @param other_sections List of other sections that the added sections will be combined with (if not NULL)
#' @param subdir directory where the new sections will be saved - in the create_template
#' fxn this defaults to the location where the template is saved
#' @inheritParams create_template
#' @param subdir Directory where the new sections will be saved. In the
#' create_template function, this defaults to the location where the
#' template is saved.
#'
#' @return Add an additional section to the report template if it is not already
#' in the default template. This provides the option to adding it as a
#' subsection either before or after it or within the subsection itself
#' as a child document.
#' @return Add an additional section or subsection to the report template
#' if it is not already present in the default template. This provides
#' the option to add it as a section before or after an existing section,
#' or within a section as a child document.
#' @export
#'
#' @examples add_section(
#' sec_names = "Ecosystem Considerations", location = "after-discussion",
#' other_sections = c("introduction.qmd", "model.qmd", "results.qmd", "discussion.qmd"),
#' new_section = "Ecosystem Considerations", section_location = "after-discussion",
#' custom_sections = c("introduction.qmd", "model.qmd", "results.qmd", "discussion.qmd"),
#' subdir = tempdir()
#' )
add_section <- function(
sec_names = NULL,
location = NULL,
other_sections = NULL,
new_section = NULL,
section_location = NULL,
custom_sections = NULL,
subdir = NULL) {
# Location options
# before-section
# after-section
# in-section (will always append to the end of the section)
for (i in 1:length(sec_names)) {
section_i_name <- paste0(gsub(" ", "_", sec_names[i]), ".qmd")
local_section <- forstringr::str_extract_part(location[i], "-", before = FALSE)
local_section_prev <- forstringr::str_extract_part(location[i - 1], "-", before = FALSE)
for (i in 1:length(new_section)) {
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)

if (any("TRUE" %in% grepl("-", location))) {
locality <- forstringr::str_extract_part(location[i], "-", before = TRUE)
locality_prev <- forstringr::str_extract_part(location[i - 1], "-", before = TRUE)
} else if (any("TRUE" %in% grepl(" ", location))) {
locality <- forstringr::str_extract_part(location[i], " ", before = TRUE)
locality_prev <- forstringr::str_extract_part(location[i - 1], "-", before = TRUE)
if (any("TRUE" %in% grepl("-", section_location))) {
locality <- forstringr::str_extract_part(section_location[i], "-", before = TRUE)
locality_prev <- forstringr::str_extract_part(section_location[i - 1], "-", before = TRUE)
} else if (any("TRUE" %in% grepl(" ", section_location))) {
locality <- forstringr::str_extract_part(section_location[i], " ", before = TRUE)
locality_prev <- forstringr::str_extract_part(section_location[i - 1], "-", before = TRUE)
}

section_i <- paste0(
"## ", stringr::str_to_title(sub("_", " ", sec_names[i])), "\n",
"## ", stringr::str_to_title(sub("_", " ", tolower(new_section[i]))), "\n",
"\n",
"[Insert text here]", "\n",
"\n",
Expand All @@ -58,18 +48,18 @@ add_section <- function(
utils::capture.output(cat(section_i), file = paste0(subdir, "/", section_i_name), append = FALSE)

if (locality == "before") {
other_sections <- append(other_sections, section_i_name, after = (which(grepl(local_section, other_sections)) - 1))
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) {
other_sections <- append(other_sections, section_i_name, after = which(grepl(gsub(" ", "_", sec_names[i - 1]), other_sections)))
custom_sections <- append(custom_sections, section_i_name, after = which(grepl(gsub(" ", "_", tolower(new_section[i - 1])), custom_sections)))
} else {
other_sections <- append(other_sections, section_i_name, after = which(grepl(local_section, other_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)
} else {
stop("Invalid selection for placement of section. Please name the follow the format 'placement-section_name' for adding a new section.")
}
}
other_sections
custom_sections
}
Loading
Loading