我希望将EndNote生成的XML文件放入R数据框中。
我希望每个最后的子节点(例如标题、作者...)成为一列
此处提供了一个示例EndNote xml文件:
我还没有用库(XML)解决这个问题。我希望有人有现成的解决方案,如果这听起来懒惰,很抱歉。
发布于 2012-10-04 10:44:14
我在转换为数据帧时遇到了类似的问题。我在子节点上使用了xmlToDataFrame。
library(XML)
library(RCurl)
urldata<-"https://gist.github.com/raw/3831049/80f1315ba03d278b4f5f0d916fb1999709fc40e6/endnote.xml"
urldata<-xmlParse(getURL(urldata,ssl.verifypeer = FALSE,.opts=curlOptions(followlocation=TRUE)))
xmlToDataFrame(getNodeSet(urldata,'//*/record'))
# database source-app rec-number foreign-keys ref-type
# 1 EndNote Ecology.enl EndNote 13264 13264 17
# 2 EndNote Ecology.enl EndNote 13265 13265 17
# contributors auth-address
# 1 Chapman, A. G. Cent States Forest Expt Stn, Columbus, OH USA
# 2 Strohecker, H. F. Univ Chicago, Chicago, IL USA
# titles
# 1 An ecological basis for reforestation of submariginal lands in the Central Hardwood RegionEcologyEcology
# 2 A survey of soil temperatures in the Chicago areaEcologyEcology
# periodical alt-periodical pages volume number dates isbn
# 1 EcologyEcology EcologyEcology 93-105 18 1 1937Jan 0012-9658
# 2 EcologyEcology EcologyEcology 162-168 18 1 1937Jan 0012-9658
# accession-num notes
# 1 ISI:000200148800007 V02fg\rTimes Cited:5\rCited References Count:2
# 2 ISI:000200148800014 V02fg\rTimes Cited:5\rCited References Count:14
# urls language
# 1 <Go to ISI>://000200148800007 English
# 2 <Go to ISI>://000200148800014 English如果在一般情况下使用,可能会出现多个作者的问题(这里不会发生)等,这可能需要稍作更改。
https://stackoverflow.com/questions/12719400
复制相似问题