Initiate a directory that contains all of the files needed for a stock assessment document written with sa4ss.

draft(
  authors,
  species = "Species name",
  latin = "Scientific name",
  coast = "U.S. West Coast",
  type = c("sa"),
  create_dir = FALSE,
  edit = FALSE,
  ...
)

Arguments

authors

A vector of author names. For example, "John R. Doe" without first name first. The middle initial or name is optional. Entries must exactly match those used in the "data-raw\authors.csv" file. If you need additional authors added to this file please contact the package maintainers or add them to the .csv file and run the R script also found in that folder prior to submitting a pull request. Following this workflow ensures that the author's address is also added.

species

A vector of character strings providing species names for all species included in the stock assessment. Typically, there will only be one species, but this template can accommodate a species complex as well. Each species should be capitalized as you would like to see it used in the middle of a sentence. For example, "Pacific Hake" is used in the stock assessment of hake; not "pacific hake" because Pacific Hake is the preferred name, not pacific hake. The text can be called in the document using spp for the form to be used in the middle of a sentence and Spp when placed at the beginning of a sentence.

latin

A character string specifying the Latin name without italic formatting. Please capitalize as you want it to be used in the document though because case will not be altered.

coast

A character string specifying which part of the coast the stock assessment includes. For example, "U.S. West Coast", which is the default, will be used to create the following title: "Status of common name (latin name) along the U.S. West Coast in 2010". Previously, the word coast was added internally to the text, this is no longer the default behavior of sa4ss and instead you must explicitly add the word, which allows users to have more flexibility. For example, "California Coast from Point Conception north" is a viable option.

type

The name of the template you want to initiate. The default template is sa, which stands for stock assessment. As development for sa4ss progresses, expect to see more templates become available. Available templates are listed in the default function call. Specify a single character value from those available if you want to change the type from the default.

create_dir

A logical value that leads to the draft document being placed in its own directory called "doc". The default value of FALSE uses the current working directory rather than containing all of the files in a new directory, which is helpful if you want to use your own name for the directory. TRUE will create the new directory "doc" and copy of the necessary files into it. A third option also exists, "default", which allows rmarkdown::draft(), to determine the appropriate directory structure.

edit

A logical value, with a default of FALSE, specifying if you want to open the indexing file for editing by default. The software chosen by R is normally not ideal and the file is not a file that is normally edited by users, which is why sa4ss does not follow the default value used by rmarkdown::draft().

...

Additional arguments that you wish to pass to rmarkdown::draft(). See args(rmarkdown::draft).

Value

Invisibly returns the file name of the document, which will be the main indexing file that links to the auxiliary files. If edit = TRUE, this file will be opened for editing.

Details

Wrapper for rmarkdown::draft()

The function is based on rmarkdown::draft() that creates new R Markdown documents based on templates stored within R packages. The rticles R package stores the most templates, mainly for the submission of manuscripts to journals.

User input for parameters such as authors and species help customize the draft to your stock assessment document. Therefore, users should focus on the input arguments that come before type = because these will be specific to the stock assessment and are used to set up the initial file structure.

File structure

A template contains two mandatory objects,

  • template.yaml

  • skeleton/skeleton.Rmd, and optional files include those in a directory named resources and additional files within the skeleton directory. Because it is not known what your directory will be named, the skeleton file is renamed to 00a.Rmd by this function to ensure that it comes first in bookdown's rendering of all of the .Rmd files, which is done alphabetically unless users specify all the files, an option that we do not really want to use.

See also

See draft.

Author

Kelli F. Johnson

Examples

if (FALSE) {
sa4ss::draft()
}