我想下载所有发布的数据摘要.
有谁知道我如何轻松下载所有发表的文章摘要?
我得到了数据来源:
ftp://ftp.ncbi.nlm.nih.gov/pub/pmc/af/12/
反正有没有下载所有这些tar文件..
提前致谢.
最佳答案 有一个名为rentrez
https://ropensci.org/packages/的包.看一下这个.您可以通过特定关键字或PMID等检索摘要.我希望它有所帮助.
更新:您可以通过以下代码传递IDS列表来下载所有摘要.
library(rentrez)
library(xml)
your.ids <- c("26386083","26273372","26066373","25837167","25466451","25013473")
# rentrez function to get the data from pubmed db
fetch.pubmed <- entrez_fetch(db = "pubmed", id = your.ids,
rettype = "xml", parsed = T)
# Extract the Abstracts for the respective IDS.
abstracts = xpathApply(fetch.pubmed, '//PubmedArticle//Article', function(x)
xmlValue(xmlChildren(x)$Abstract))
# Change the abstract names with the IDS.
names(abstracts) <- your.ids
abstracts
col.abstracts <- do.call(rbind.data.frame,abstracts)
dim(col.abstracts)
write.csv(col.abstracts, file = "test.csv")