【问题标题】:How to get EndNote xml file into an R data frame如何将 EndNote xml 文件放入 R 数据框中
【发布时间】:2012-10-04 21:08:09
【问题描述】:

我希望将 EndNote 生成的 XML 文件放入 R 数据框中。

我希望每个最终的子节点(例如标题、作者...)成为一列

此处提供了一个示例 EndNote xml 文件:

Example on gist

我还没有使用库(XML)解决这个问题。我希望有人有现成的解决方案,如果这听起来很懒,请见谅。

【问题讨论】:

  • 有没有办法将其保存为常规的尾注 .enl 文件?
  • 我认为 pandoc 可能有这个能力。它可以将其转换为 .bib 文件,然后使用 jabref 导出为 csv 文件。

标签: xml r reference


【解决方案1】:

我在转换为数据框时遇到了类似的问题。我在子节点上使用了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

如果一般使用可能需要多位作者的一些问题(此处不会发生)等,可能需要稍作改动。

【讨论】:

  • 哇!虽然有人已经完成了腿部工作!非常感谢!
猜你喜欢
  • 2016-08-12
  • 1970-01-01
  • 1970-01-01
  • 2010-12-29
  • 2021-12-31
  • 1970-01-01
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
相关资源
最近更新 更多