Skip to content

Instantly share code, notes, and snippets.

@rossmounce
Last active July 14, 2017 09:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rossmounce/b51d8a841e4e3049992cdb0280b3ea29 to your computer and use it in GitHub Desktop.
Save rossmounce/b51d8a841e4e3049992cdb0280b3ea29 to your computer and use it in GitHub Desktop.
How many freely accessible works do Nobel prize winners have?
install.packages('rorcid')
install.packages('roadoi')
library(roadoi)
library(rorcid)
#Example ORCID given is that of Carol Greider, American molecular biologist
an.ORCID.ID <- "0000-0002-5494-8126"
#This step gets all works publicly known to ORCID to be associated to this person
out <- works(orcid_id(your.ORCID.ID))
#This step filters the list of works to only those which have a DOI
ids <- dplyr::bind_rows(Filter(
Negate(is.null),
out$data$`work-external-identifiers.work-external-identifier`
))
doisonly <- ids[ids$`work-external-identifier-type` == "DOI", ]
doisonly$`work-external-identifier-id.value` <- gsub("^","http://doi.org/",doisonly$`work-external-identifier-id.value`)
doisonly$`work-external-identifier-id.value` <- gsub("DOI: ","",doisonly$`work-external-identifier-id.value`)
uniquedois <- unique(doisonly$`work-external-identifier-id.value`)
length(uniquedois) #48 works with a DOI registered to this ORCID
#The OADOI API requests that you kindly supply your email address so they know who is using the service and other reasons, see here for more: https://github.com/njahn82/roadoi
your.email.address <- "youremail@mail.com"
#This is the magic step. This OA compliance checking API isn't 100% accurate. Always do manual checks in addition if it's important.
x <- roadoi::oadoi_fetch(dois = uniquedois,
email = your.email.address,
.progress = "text")
#Quick summary
table(x$is_free_to_read)
# FALSE TRUE
# 28 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment