服务热线
178 0020 3020
library("httr") yearData=c() countData=c() url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi" for(i in 1:10){ year=2007+i term = paste('(Small nucleolar RNA[TI]) AND ',year,'[DP]',sep = "") r <- POST(url, body = list( db='pubmed', term=term, retmode='json', retstart=0, retmax=10, rettype='uilist' ) ) stop_for_status(r) #清除http状态字符串 data=content(r, "parsed", "application/json") esearchresult=data$esearchresult count = esearchresult$count yearData=c(yearData,year) countData=c(countData,count) } data=data.frame(year=yearData,count=countData) print(data) library(ggplot2) ggplot(data,aes(x=factor(year),y=count))+ geom_bar(aes(fill=year), stat="identity",width = 0.8)+ geom_text(label=data$count,vjust=-0.5)+ xlab("year")+ylab("count")+ theme_bw()+ theme(legend.position="none")+ ggtitle("R2-20")
好奇怪,没办法上传图片或者附件
附件