Skip to content

Instantly share code, notes, and snippets.

@plasmid02
Created September 28, 2016 13:59
Show Gist options
  • Save plasmid02/317ac08a3ba47985a3f1636b108eb77b to your computer and use it in GitHub Desktop.
Save plasmid02/317ac08a3ba47985a3f1636b108eb77b to your computer and use it in GitHub Desktop.
gets coauthors over a specified time range
#Usage: get_pubmed_coauthors(auth = "mason ce", stdate= "2014", enddate = "2016")
get_pubmed_coauthors <- function(auth = "read td",stdate = "2013", enddate= "2016") {
library(RISmed)
library(dplyr)
res <- EUtilsSummary(auth, type='esearch', db='pubmed', mindate=stdate, maxdate=enddate)
fetch <- EUtilsGet(res)
a_list = NULL
for (i in 1:length(Author(fetch))){
if (i == 1) {a_list <- Author(fetch)[[1]][,1:2]}
else {
a_list <- dplyr::union(a_list,Author(fetch)[[i]][,1:2])
}
}
return(a_list)
}
#need to figure out a way to get affiliation: crossref against google scholar?
#thanks to Chris Mason and this blogpost:
#http://davetang.org/muse/2013/10/31/querying-pubmed-using-r/
#ps - I offer no guarantees of accuracy and no tech support. Use at your own risk!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment