Get a vector of template file names that are available for a given section.
By section, we are referring to a section in the document such as the
section on fishery-independent information, which is denoted in the
files using s
for survey and is part of the Data section.
get_templatenames(
precursor = "",
separator = "-",
dir = system.file("rmarkdown", "templates", "sa", package = "sa4ss")
)
A character string that starts with a two-digit number
and is followed by a single alpha character that specifies the type.
Specifically, everything before the "-"
in the .Rmd
files
that are available in the package.
A character string that separates the precursor
from
the rest of the file name. The default is a dash.
A file path to the directory of interest. It can be relative or absolute. The default value looks to see the available options in the package folder, but you can change this to be the folder for your stock assessment, which would be helpful if you have added or deleted certain files from the default template.
Returns a vector of file names with their extensions.
Motiviation: As the package develops, it is the hope that the number of available template files will increase because it is not fruitful for everyone to constantly re-write default text. For example, the background information for the Triennial survey should be the same regardless of species. Or, software used to work up a given data set should be the same across most species such as the ageing-error software that has been kindly provided by Dr. Punt and others.
# To list all available templates within each section
get_templatenames()
#> [1] "21s-aslope.Rmd" "21s-calcofi.Rmd" "21s-ccfrp.Rmd" "21s-hkl.Rmd"
#> [5] "21s-tri.RMd" "21s-wcgbts.Rmd"
# To remove file extension from the returned names
gsub("\\..{3}$", "", get_templatenames())
#> [1] "21s-aslope" "21s-calcofi" "21s-ccfrp" "21s-hkl" "21s-tri"
#> [6] "21s-wcgbts"