Created
March 15, 2016 00:39
-
-
Save wkmor1/ae2cc96acad472d49c35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Convert doi to bibtex | |
#' | |
#' Convert a digital object identifier (doi) string into a bibtex entry using the | |
#' webserice \link{http://www.doi2bib.org}. | |
#' | |
#' @param doi The character string of the doi. | |
#' | |
#' @return a bibtex entry as a character string. | |
#' | |
#' @importFrom httr accept content GET | |
#' | |
#' @example | |
#' doi2bib("10.1038/350132215) | |
#' | |
#' @export | |
setGeneric( | |
"doi2bib", | |
function(doi) { | |
standardGeneric("doi2bib") | |
} | |
) | |
setMethod( | |
"doi2bib", | |
c(doi = "character"), | |
function (doi) { | |
content( | |
GET( | |
url = "http://www.doi2bib.org/", | |
config = accept("application/x-bibtex"), | |
path = "doi2bib", | |
query = list(id = doi) | |
), | |
as = "text" | |
) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, found your package. Google found this first, I'll leave this link here for others that might stumble here first like I did:
https://github.com/wkmor1/doi2bib