To see templates included in the base skeleton, please run 'list.files(system.file('templates','skeleton', package = 'asar'))' in the console.

create_template(
  format = "pdf",
  type = "SAR",
  office = c("AFSC", "PIFSC", "NEFSC", "NWFSC", "SEFSC", "SWFSC"),
  region = NULL,
  species = "species",
  spp_latin = NULL,
  year = format(as.POSIXct(Sys.Date(), format = "%YYYY-%mm-%dd"), "%Y"),
  authors = NULL,
  file_dir = getwd(),
  title = "[TITLE]",
  model_results = NULL,
  tables_dir = getwd(),
  figures_dir = getwd(),
  spp_image = "",
  bib_file = "asar_references.bib",
  new_template = TRUE,
  rerender_skeleton = FALSE,
  custom = FALSE,
  custom_sections = NULL,
  new_section = NULL,
  section_location = NULL,
  parameters = TRUE,
  param_names = NULL,
  param_values = NULL,
  ...
)

Arguments

format

Rendering format (pdf, html, or docx).

type

Type of report to build. Default is SAR (NOAA Fisheries Stock Assessment Report).

office

Regional Fisheries Science Center producing the report (i.e., AFSC, NEFSC, NWFSC, PIFSC, SEFSC, SWFSC).

region

Full name of region in which the species is evaluated (if applicable). If the region is not specified for your center or species, do not use this variable.

species

Full common name for target species. Split naming with a space and capitalize first letter(s). Example: "Dover sole".

spp_latin

Latin name for the target species. Example: "Pomatomus saltatrix".

year

Year the assessment is being conducted. Default is the year in which the report is rendered.

authors

A character vector of author names with their accompanying affiliations. For example, a Jane Doe at the NWFSC Seattle, Washington office would have an entry of c("Jane Doe"="NWFSC-SWA"). Information on NOAA offices is found in a database located in the package: system.file("resources", "affiliation_info.csv", package = "asar"). Keys to the office addresses follow the naming convention of the office acronym (ex. NWFSC) with a dash followed by the first initial of the city then the 2 letter abbreviation for the state the office is located in. If the city has 2 or more words such as Panama City, the first initial of each word is used in the key (ex. Panama City, Florida = PCFL)

file_dir

Location of stock assessment files produced by this function. Default is the working directory.

title

A custom title that is an alternative to the default title (composed in asar::create_title()). Example: "Management Track Assessments Spring 2024".

model_results

Path to standard output file made from asar::convert_output()

tables_dir

The location of the "tables" folder, which contains tables files. Default is the working directory.

figures_dir

The location of the "figures" folder, which contains figures files. Default is the working directory.

spp_image

File path to the species' image if not using the image included in the project's repository.

bib_file

File path to a .bib file used for citing references in the report

new_template

TRUE/FALSE; Create a new template? If true, will pull the last saved stock assessment report skeleton. Default is false.

rerender_skeleton

Re-create the "skeleton.qmd" in your outline when changes to the main skeleton need to be made. This reproduces the yaml, output (if changed), preamble quantities, and restructures your sectioning in the skeleton if indicated. All files in your folder will remain as is.

custom

TRUE/FALSE; Build custom sectioning for the template, rather than the default for stock assessments in your region? Default is false.

custom_sections

List of existing sections to include in the custom template. Note: this only includes sections within list.files(system.file("templates", "skeleton", package = "asar")). The name of the section, rather than the name of the file, can be used (e.g., 'abstract' rather than '00_abstract.qmd'). If adding a new section, also use parameters 'new_section' and 'section_location'.

new_section

Names of section(s) (e.g., introduction, results) or subsection(s) (e.g., a section within the introduction) that will be added to the document. Please make a short list if >1 section/subsection will be added. The template will be created as a quarto document, added into the skeleton, and saved for reference.

section_location

Where new section(s)/subsection(s) will be added to the skeleton template. Please use the notation of 'placement-section'. For example, 'in-introduction' signifies that the new content would be created as a child document and added into the 02_introduction.qmd. To add >1 (sub)section, make the location a list corresponding to the order of (sub)section names listed in the 'new_section' parameter.

parameters

TRUE/FALSE; For parameterization of the script. Default is true.

param_names

List of parameter names that will be called in the document. Parameters automatically included: office, region, species (each of which are listed as individual parameters for this function, above).

param_values

List of values associated with the order of parameter names. Parameters automatically included: office, region, species (each of which are listed as individual parameters for this function, above).

...

Additional arguments passed into functions used in create_template such as create_citation(), format_quarto(), add_chunk(), ect

Value

Create template and pull skeleton for a stock assessment report. Function builds a YAML specific to the region and utilizes current resources and workflows from different U.S. Fishery Science Centers. General sections are called as child documents in this skeleton and each of the child documents should be edited separately.

Examples

if (FALSE) { # \dontrun{
create_template(
  new_section = "a_new_section",
  section_location = "before-introduction"
)


create_template(
  new_template = TRUE,
  format = "pdf",
  office = "NWFSC",
  species = "Dover sole",
  spp_latin = "Microstomus pacificus",
  year = 2010,
  authors = c(
    "John Snow" = "AFSC",
    "Danny Phantom" = "NEFSC",
    "Patrick Star" = "SEFSC-ML"
  ),
  model_results = here::here("folder", "std_output.rda"),
  figures_dir = here::here(),
  tables_dir = here::here("tables_folder_location"),
  new_section = "an_additional_section",
  section_location = "after-introduction"
)

asar::create_template(
  new_template = TRUE,
  format = "pdf",
  office = "PIFSC",
  species = "Striped marlin",
  spp_latin = "Kajikia audax",
  year = 2018,
  authors = c("John Snow" = "AFSC"),
  new_section = c("a_new_section", "another_new_section"),
  section_location = c("before-introduction", "after-introduction"),
  custom = TRUE,
  custom_sections = c("executive_summary", "introduction")
)

create_template(
  new_template = TRUE,
  format = "pdf",
  office = "NWFSC",
  region = "my_region",
  species = "Bluefish",
  spp_latin = "Pomatomus saltatrix",
  year = 2010,
  authors = c("John Snow", "Danny Phantom", "Patrick Star"),
  title = "Management Track Assessments Spring 2024",
  parameters = TRUE,
  param_names = c("region", "year"),
  param_values = c("my_region", "2024"),
  model_results = here::here("folder", "std_output.rda"),
  new_section = "an_additional_section",
  section_location = "before-discussion",
  type = "SAR",
  custom = TRUE,
  custom_sections = c("executive_summary", "introduction", "discussion"),
  spp_image = "dir/containing/spp_image"
)
} # }