Skip to content

Instantly share code, notes, and snippets.

@karthik
Created December 18, 2012 02:07
Show Gist options
  • Save karthik/4324375 to your computer and use it in GitHub Desktop.
Save karthik/4324375 to your computer and use it in GitHub Desktop.
How to grab dois from a bibtex file.
library(bibtex)
library(plyr)
# If you don't have the above mentioned packages, just run
# install.packages(package_name) before running this code.
#
# My bib file that I've used as an example
bib_raw <- read.bib('~/Desktop/citation_counts/PLOS_refs.bib')
# Once read in, the doi is a slot under each list item.
dois <- llply(bib_raw, function(x) {
return(x$doi)
})
# remove the NULLs (when objects like web pages don't have dois)
dois <- compact(dois)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment