Load packages

library(rentrez)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0     ✔ purrr   0.3.4
## ✔ tibble  3.1.8     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(ggplot2)
library(glue)

Summary of taxonomy database

entrez_db_summary(db = "taxonomy")
##  DbName: taxonomy
##  MenuName: Taxonomy
##  Description: Taxonomy db
##  DbBuild: Build221218-2000.1
##  Count: 2608449
##  LastUpdate: 2022/12/18 21:32

Set search terms

entrez_db_searchable("taxonomy")
## Searchable fields for database 'taxonomy'
##   ALL     All terms from all searchable fields 
##   UID     Unique number assigned to publication 
##   FILT    Limits the records 
##   SCIN    Scientific name of organism 
##   COMN    Common name of organism 
##   TXSY    Synonym of organism name 
##   ALLN    All aliases for organism 
##   NXLV    Immediate parent in taxonomic hierarchy 
##   SBTR    Any parent node in taxonomic hierarchy 
##   LNGE    Lineage in taxonomic hierarchy 
##   GC      Nuclear genetic code 
##   MGC     Mitochondrial genetic code 
##   PGC     Plastid genetic code 
##   TXDV    GenBank division 
##   RANK    Hierarchical position (e.g., order, genus) 
##   EDAT    Date record first accessible through Entrez 
##   MDAT    Date of last update 
##   PROP    Property defined on particular node (e.g., terminal node) 
##   WORD    Free text associated with record 
##   NTOK    Name tokens associated with organism names 
##   HGC     Hydrogenosome genetic code

Create plot

search_year <- function(year, term){
  query <- paste(term, "AND (", year, "[PDAT])") 
  entrez_search(db="pubmed", term=query, retmax=0)$count
}

year <- 1920:2020
papers <- sapply(year, search_year, term="lethocerus", USE.NAMES = FALSE)
plot(year, papers, type='b', main="Letho Publications from 1920 to 2020")