Skip to content

Instantly share code, notes, and snippets.

@dwinter
Created June 19, 2015 17:42
Show Gist options
  • Save dwinter/9efb34b24fe80991623c to your computer and use it in GitHub Desktop.
Save dwinter/9efb34b24fe80991623c to your computer and use it in GitHub Desktop.
Add to bibliography from doi
library(rcrossref)
add_to_bib <- function(doi, bib="ms.bib", print_ref=TRUE){
ref <- cr_cn(doi)
cat("\n", ref, "\n\n", file=bib, append=TRUE)
if(print_ref){
cat(ref, "\n")
}
}
#add_to_bib("10.1186/1475-2875-11-77")
#@article{McCollum_2012,
# doi = {10.1186/1475-2875-11-77},
# url = {http://dx.doi.org/10.1186/1475-2875-11-77},
# year = 2012,
# publisher = {Springer Science $\mathplus$ Business Media},
# volume = {11},
#.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment