biblioformat: Revise and Reformat a Bibliography

View source: R/biblioformat.R

biblioformatR Documentation

Revise and Reformat a Bibliography

Description

Revise and reformat a list of references provided as plain text. This function will try to identify their DOI (through Crossref), then formatting each following the chosen output format (e.g. BibTeX, or a particular journal style).

Usage

biblioformat(
  refs = NULL,
  output = c("text", "data.frame"),
  format = c("text", "bibtex"),
  style = "apa",
  filename = NULL,
  ...
)

Arguments

refs

A character vector with bibliographic references. If NULL (default), will read them from the clipboard.

output

Return references as plain text (output = "text") or as a data.frame (output = "data.frame")

format

Reference format. Either "text" (default) or "bibtex" that can e.g. be later imported in a reference manager

style

Output style for bibliography when format is "text". Default is "apa", but any of the >9000 styles available in github.com/citation-style-language/styles can be used. See cr_cn for details.

filename

Optional. Save formatted bibliography to a text file.

...

Further arguments for cr_cn.

Value

If output = "text", a character vector with revised and reformatted bibliographic references. These are automatically copied to the clipboard, so they can be directly pasted onto a document. Optionally, if filename is provided, a text file is also saved on disk. If output = "data.frame" a data.frame is returned with the input references, identified DOI, and resulting citation metatada.

Note

Some references may be changed and erroneously confounded with others. Please check the output reference list.

Examples

## Not run: 
refs <- c(
"Hansen et al. (2013) Climate sensitivity, sea level and atmospheric carbon dioxide",
"Davis, M.B. and Shaw, R.G. (2001) Science 292(5517): 673-679"
)

biblioformat(refs)

biblioformat(refs, style = "ecology-letters")
biblioformat(refs, format = "bibtex", filename = "myrefs.bib")

biblioformat(refs, format = "data.frame")


## End(Not run)


Pakillo/biblioformat documentation built on Dec. 7, 2024, 8:34 p.m.