本文介绍了如何使用R从CrossRef中提取xml数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您输入CrossRef电子邮件,则以下URL会生成一个XML文件
If you put in your CrossRef email the following URL produces an XML file
"http://www.crossref.org/openurl?title=Science&aulast=Fernández&date=2009&multihit=true&pid=your.crossref.email"
可在此处找到示例文件:
An example file is available here:
我希望将DOI(数字对象标识)列表提取到R中的data.frame中.我希望使用常规的R xml包之一
I wish to extract the list of DOI (Digital Object Identifies) into an data.frame in R.I wish to do so using one of the general R xml packages
library(XML) or library(tm)
我尝试过
doc<-xmlTreeParse(file)
top<-xmlRoot(doc)
但无法弄清楚如何从这里走
but can not figure out how to go from here
top[[1]]["doi"]
不起作用.
推荐答案
尝试一下:
library(XML)
doc <- xmlTreeParse("crossref.xml", useInternalNodes = TRUE)
root <- xmlRoot(doc)
xpathSApply(root, "//x:doi", xmlValue, namespaces = "x")
这篇关于如何使用R从CrossRef中提取xml数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!