To see templates included in the base skeleton, please run 'list.files(system.file('templates','skeleton', package = 'asar'))' in the console.
create_template(
new_template = TRUE,
format = c("pdf", "docx", "html", NULL),
office = c("AFSC", "PIFSC", "NEFSC", "NWFSC", "SEFSC", "SWFSC"),
region = NULL,
complex = FALSE,
species = NULL,
spp_latin = NULL,
year = NULL,
file_dir = getwd(),
author = "",
add_author = NULL,
include_affiliation = TRUE,
simple_affiliation = FALSE,
alt_title = FALSE,
title = NULL,
parameters = TRUE,
param_names = NULL,
param_values = NULL,
convert_output = FALSE,
fleet_names = NULL,
resdir = NULL,
model_results = NULL,
model = NULL,
new_section = NULL,
section_location = NULL,
type = "SAR",
prev_year = NULL,
custom = FALSE,
custom_sections = NULL,
include_figures = TRUE,
include_tables = TRUE,
add_image = FALSE,
spp_image = NULL,
bib_file = "asar_references.bib",
rda_dir = getwd(),
scale_amount = 1,
end_year = NULL,
n_projected_years = 10,
relative = FALSE,
recruitment_unit_label = "metric tons",
ref_line = c("target", "MSY", "msy", "unfished"),
ref_point = NULL,
landings_unit_label = "metric tons",
ref_point_sb = NULL,
spawning_biomass_label = "metric tons",
ref_line_sb = c("target", "MSY", "msy", "unfished"),
indices_unit_label = "",
biomass_unit_label = "mt",
catch_unit_label = "mt"
)
TRUE/FALSE; Create a new template? If true, will pull the last saved stock assessment report skeleton. Default is false.
Rendering format (pdf, html, or docx).
Regional Fisheries Science Center producing the report (i.e., AFSC, NEFSC, NWFSC, PIFSC, SEFSC, SWFSC).
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.
TRUE/FALSE; Is this a species complex? Default is false.
Full common name for target species. Split naming with a space and capitalize first letter(s). Example: "Dover sole".
Latin name for the target species. Example: "Pomatomus saltatrix".
Year the assessment is being conducted. Default is the year in which the report is rendered.
Location of stock assessment files produced by this function. Default is the working directory.
Ordered list of authors included in the assessment.
Author that is not currently in the database and who should be temporarily added to the author list. Format as "First MI Last". Please leave a comment on the GitHub issues page to be added.
TRUE/FALSE; Does the analyst want to include the authors' affiliations in the document? Default is false.
TRUE/FALSE; If including affiliations, should the office name function as the affiliation, rather than the full address? Default is true.
TRUE/FALSE; Use a title that is not the default title (i.e., an alternative title)? Default is false.
The alternative title. Example: "Management Track Assessments Spring 2024".
TRUE/FALSE; For parameterization of the script. Default is true.
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).
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).
TRUE/FALSE; Convert the output file to standard model format while creating report template? Default is false.
Deprecated: List of fleet names as described in BAM output file (abbreviations).
Filepath of the directory storing the model results file(s). Examples where dover_sole_2024 is the project root for absolute and relative filepaths, respectively: "C:/Users/patrick.star/Documents/dover_sole_2024/models", "here::here("models")".
The model results file. Before the stock assessment output file has been converted to a standardized format with the function convert_output.R, the model results file may be a .sso or .rdata file. After conversion, this file will be a .csv file.
Type of assessment model that was used to assess the stock (e.g., "BAM", "SS3", "AMAK", "ASAP", etc.).
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.
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.
Type of report to build. Default is SAR.
Year in which the previous assessment report was conducted. Used to pull previous assessment template.
TRUE/FALSE; Build custom sectioning for the template, rather than the default for stock assessments in your region? Default is false.
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'.
TRUE/FALSE; Should figures be included in the report? Default is true.
TRUE/FALSE; Should tables be included in the report? Default is true.
TRUE/FALSE; Add image of species to the template that is not already included in the project's inst/resources/spp_img folder? Default is false.
File path to the species' image if not using the image included in the project's repository.
File path to a .bib file used for citing references in the report
If the user has already created .rda files containing
figures, tables, alt text, and captions with satf
, rda_dir represents
the location of the folder containing these .rda files ("rda_files").
Otherwise, if the user has not used satf
to make those .rda files already,
those files will be generated automatically and placed within the "report"
folder within the file_dir
. The "rda_files" folder would have been
made with satf::exp_all_figs_tables()
, or by exporting files by running individual
satf
figure- and table-generating functions. If you have used satf
to
generate these .rda files, you can leave the arguments below blank. NOTE:
If an "rda_files" folder is detected within rda_dir, .rda files will not be
regenerated.
The last year of assessment. The default is year - 1.
Number of years spawning biomass is projected for. By default this number is set to 10
A logical value specifying if the resulting figures should be relative spawning biomass. The default is 'FALSE'. 'ref_line' indicates which reference point to use.
Units for recruitment
An argument inherited from satf::plot_spawning_biomass.R
.
A string specifying the type of reference you want to
compare spawning biomass to. The default is "target"
, which looks for
"spawning_biomass_target"
in the "label"
column of dat
. The actual
searching in dat
is case agnostic and will work with either upper- or
lower-case letters but you must use one of the options specified in the
default list to ensure that the label on the figure looks correct
regardless of how it is specified in dat
.
An argument inherited from satf::plot_biomass.R
. A known
value of the reference point along with the label for the reference point as
specified in the output file. Please use this option if the ref_line cannot
find your desired point. Indicate the reference point in the form
c("label" = value).
Units for landings
Identical definition as ref_point
, but this argument is
applied to plot_spawning_biomass.
Units for spawning biomass
A string specifying the type of
reference you want to compare spawning biomass to. The default is "target"
,
which looks for "spawning_biomass_target"
in the "label"
column of dat
.
The actual searching in dat
is case agnostic and will work with either upper- or
lower-case letters but you must use one of the options specified in the
default list to ensure that the label on the figure looks correct
regardless of how it is specified in dat
.
Units for index of abundance/CPUE
Abbreviated units for biomass
Abbreviated units for catch
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.
if (FALSE) { # \dontrun{
create_template(
new_section = "a_new_section",
section_location = "before-introduction",
rda_dir = here::here()
)
create_template(
new_template = TRUE,
format = "pdf",
office = "NWFSC",
species = "Dover sole",
spp_latin = "Microstomus pacificus",
year = 2010,
author = c("John Snow", "Danny Phantom", "Patrick Star"),
include_affiliation = TRUE,
resdir = "C:/Users/Documents/Example_Files",
model_results = "Report.sso",
model = "SS3",
new_section = "an_additional_section",
section_location = "after-introduction",
rda_dir = here::here()
)
asar::create_template(
new_template = TRUE,
format = "pdf",
office = "PIFSC",
species = "Striped marlin",
spp_latin = "Kajikia audax",
year = 2018,
author = "Alba Tross",
model = "BAM",
new_section = c("a_new_section", "another_new_section"),
section_location = c("before-introduction", "after-introduction"),
custom = TRUE,
custom_sections = c("executive_summary", "introduction"),
rda_dir = here::here()
)
create_template(
new_template = TRUE,
format = "pdf",
office = "NWFSC",
region = "my_region",
complex = FALSE,
species = "Bluefish",
spp_latin = "Pomatomus saltatrix",
year = 2010,
author = c("John Snow", "Danny Phantom", "Patrick Star"),
add_author = "Sun E Day",
include_affiliation = TRUE,
simple_affiliation = TRUE,
alt_title = FALSE,
title = "Management Track Assessments Spring 2024",
parameters = TRUE,
param_names = c("region", "year"),
param_values = c("my_region", "2024"),
convert_output = FALSE,
fleet_names = c("fleet1", "fleet2", "fleet3"),
resdir = "C:/Users/Documents/Example_Files",
model_results = "Report.sso",
model = "SS3",
new_section = "an_additional_section",
section_location = "before-discussion",
type = "SAR",
prev_year = 2021,
custom = TRUE,
custom_sections = c("executive_summary", "introduction", "discussion"),
include_figures = TRUE,
include_tables = TRUE,
add_image = TRUE,
spp_image = "dir/containing/spp_image",
rda_dir = "C:/Users/Documents",
scale_amount = 1,
end_year = 2022,
n_projected_years = 10,
relative = FALSE,
recruitment_unit_label = "metric tons",
ref_line = "target",
landings_unit_label = "metric tons",
spawning_biomass_label = "metric tons",
recruitment_unit_label = "metric tons",
ref_line_sb = "target",
indices_unit_label = "CPUE",
biomass_unit_label = "mt",
catch_unit_label = "mt"
)
} # }