knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
This package aims to help with revising and reformatting reference lists (bibliographies) in plain text format. It takes a reference list as plain text, tries to retrieve DOIs and metadata from Crossref, and reformat them according to a chosen style (e.g. BibTeX, or following a particular journal citation style).
install.packages("biblioformat", repos = c("https://pakillo.r-universe.dev", "https://cloud.r-project.org"))
The motivation for this package is the need to revise and/or reformat reference lists (bibliographies) only available as plain text (e.g. at the end of a manuscript or document). This happens e.g. when our manuscript is rejected from a journal and we need to reformat the bibliography and we don't have the original bibliographic database (as BibTeX, Mendeley, Zotero...) but only a plain text of references.
This package takes the text with references, tries to identify their DOIs and metadata at Crossref, and outputs the revised citations in the chosen format (BibTeX, a particular journal style...).
For example, if we have these references that we want to check (and optionally reformat):
Foster, G. et al. (2017) Future climate forcing potentially without precedent in the last 420 million years.
Chen, I.-C. et al. (2011) Science 333, 1024-1026
We can copy them to the clipboard or provide them as a character vector:
refs <- c( "Foster, G. et al. (2017) Future climate forcing potentially without precedent in the last 420 million years.", "Chen, I.-C. et al. (2011) Science 333, 1024-1026" )
then
library(biblioformat) newrefs <- biblioformat(refs, style = "global-ecology-and-biogeography") newrefs
Note that missing titles and journals have now been corrected. We can use >9000 different citation styles.
The revised references are automatically copied to the clipboard, so they can be directly pasted into the original document.
Alternatively, we can obtain the references in BibTeX format, for further editing or importing into a reference manager
newrefs <- biblioformat(refs, format = "bibtex", filename = "myrefs.bib")
Note that some references may be changed and erroneously confounded with others. Please check the output reference list.
This package is just a wrapper of the excellent rcrossref
package by rOpenSci - big thanks to them!
See also https://anystyle.io/ for an excellent free online parser of bibliographic references (or Ranystyle to run from R). Also http://cermine.ceon.pl/cermine/index.html, and others...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.