Skip to content

Instantly share code, notes, and snippets.

@neilfws
Last active June 30, 2017 04:49
Show Gist options
  • Save neilfws/6d18e08962b93bce5afa9bbadddc9543 to your computer and use it in GitHub Desktop.
Save neilfws/6d18e08962b93bce5afa9bbadddc9543 to your computer and use it in GitHub Desktop.
The very basics of PubMed search using rentrez
library(rentrez)
# search for "epigenetics"
es <- entrez_search("pubmed", "epigenetics")
es$count
[1] 20759
# search for "epigenetics" published in 2014
# for all publications in 2014 just drop the "epigenetics"
es <- entrez_search("pubmed", "epigenetics 2014[dp]")
es$count
[1] 3338
# in Nature
es <- entrez_search("pubmed", "epigenetics 2014[dp] Nature[ta]")
es$count
[1] 25
# for all publications in 2014 just drop the "epigenetics"
es <- entrez_search("pubmed", "2014[dp]")
es$count
[1] 1199669
# get a summary for a publication ID
es <- entrez_search("pubmed", "epigenetics 2014[dp]")
# 20 IDs by default
es$ids
[1] "26807331" "26567096" "26484155" "26484145" "26484140" "26484114" "26464963" "26461333" "26442173"
[10] "26317049" "26255941" "26201320" "26089608" "26012316" "25976256" "25969372" "25960869" "25905376"
[19] "25878004" "25873785"
# summary of the first ID
esum <- entrez_summary("pubmed", es$ids[1])
# the journal
esum$source
[1] "Hereditary Genet"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment