Learn R Programming

rcrossref (version 0.3.0)

cr_cn: Get citations in various formats from CrossRef.

Description

Get citations in various formats from CrossRef.

Usage

cr_cn(dois, format = "text", style = "apa", locale = "en-US",
  .progress = "none", ...)

Arguments

dois
Search by a single DOI or many DOIs.
format
Name of the format. One of "rdf-xml", "turtle", "citeproc-json", "text", "ris", "bibtex", "crossref-xml", "datacite-xml","bibentry", or "crossref-tdm"
style
a CSL style (for text format only). See get_styles for options. Default: apa. If there's a style that CrossRef doesn't support you'll get a (500) Internal Server Error
locale
Language locale. See ?Sys.getlocale
.progress
Show a plyr-style progress bar? Options are "none", "text", "tk", "win, and "time". See create_progress_bar for details of each.
...
Named parameters passed on to GET

Details

See http://www.crosscite.org/cn/ for more info on the Crossref Content Negotiation API service.

Examples

Run this code
cr_cn(dois="10.1126/science.169.3946.635")
cr_cn(dois="10.1126/science.169.3946.635", format="citeproc-json")
cr_cn("10.1126/science.169.3946.635", "rdf-xml")
cr_cn("10.1126/science.169.3946.635", "crossref-xml")
cr_cn("10.1126/science.169.3946.635", "bibtex")

# return an R bibentry type
cr_cn("10.1126/science.169.3946.635", "bibentry")
cr_cn("10.6084/m9.figshare.97218", "bibentry")

# return an apa style citation
cr_cn("10.1126/science.169.3946.635", "text", "apa")
cr_cn("10.1126/science.169.3946.635", "text", "harvard3")
cr_cn("10.1126/science.169.3946.635", "text", "elsevier-harvard")
cr_cn("10.1126/science.169.3946.635", "text", "ecoscience")
cr_cn("10.1126/science.169.3946.635", "text", "heredity")
cr_cn("10.1126/science.169.3946.635", "text", "oikos")

# example with many DOIs
dois <- cr_r(2)
cr_cn(dois, "text", "apa")

# Cycle through random styles - print style on each try
stys <- get_styles()
foo <- function(x){
 cat(sprintf("<Style>:%s\n", x), sep = "\n\n")
 cr_cn("10.1126/science.169.3946.635", "text", style=x)
}
foo(sample(stys, 1))

Run the code above in your browser using DataLab