R crawler used for pubmed

tool

RISmed (library)
Chinese community actually did not let me introduce his incredible reason that I made a simple introduction.

installation

install.packages('RISmed')

use

library(RISmed)
  1. First we have to define a tag search:
search_tags = 'sleep'

You can then call the function of the very violence:

  • EUtilsSummary
Usage
EUtilsSummary(query,type="esearch",db="pubmed",url=NULL,encoding="unknown",...)
Arguments
query	
string query as given in NCBI search box

type	
string indicating type of NCBI Eutility

db	
string indicating the NCBI database used in query

url	
string of url to bypass query construction

encoding	
encoding to be assumed for input strings, see readLines

...	
additional limits added to query

tips

Windows students pay attention encoding

Call EUtilsSummary

> search_query = EUtilsSummary(search_tags,retmax=100)
> summary(search_query)
Query:
"sleep"[MeSH Terms] OR "sleep"[All Fields] 

Result count:  205279

query为search build:

“sleep”[MeSH Terms] OR “sleep”[All Fields]

retmax maximum number of documents crawled

After-treatment

pubmed_data = data.frame('Title' = ArticleTitle(records),'Abstract'=AbstractText(records))
pubmed_data$Abstract <- as.character(pubmed_data$Abstract)
pubmed_data$Abstract <- gsub(",", " ", pubmed_data$Abstract, fixed = TRUE)
> str(pubmed_data)
'data.frame':	99 obs. of  2 variables:
 $ Title   : Factor w/ 97 levels "A common hub for sleep and motor control in the substantia nigra.",..: 41 56 49 45 4 35 94 2 83 51 ...
 $ Abstract: chr  "BACKGROUND: Sleep apnoea is prevalent in dialysis patients. Previous studies identified excessive inflammation "| __truncated__ "AIMS: A large proportion of patients at memory disorders clinics are classified as having subjective cognitive "| __truncated__ "BACKGROUND: Despite the abundance of data documenting the consequences of poor sleep quality on blood pressure "| __truncated__ "Sleep difficulties are commonly reported by patients with epilepsy and can have a detrimental impact on overall"| __truncated__ ...

well done

Released three original articles · won praise 0 · Views 299

Guess you like

Origin blog.csdn.net/weixin_44405279/article/details/104092790