我正在尝试从 oData 源检索 R 中的数据。该脚本有效,但是在我更新了一些软件包后,该脚本需要 xml2 软件包,这导致了错误。
library('httr') # for sending http requests
library("xml2") # for reading xml
# log start of request
log_message(paste("Requesting OData from:",url))
# get the OData resource
response <- GET(url,authenticate(usr,pwd))
# parse xml docucument
responseContent <- content(response,type="text/xml")
# determine the names of the attributes
xmlNames <- xpathApply(responseContent,
'//ns:entry[1]//m:properties[1]/d:*',xmlName,
namespaces = c(ns = "http://www.w3.org/2005/Atom",
m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
d="http://schemas.microsoft.com/ado/2007/08/dataservices"))
在确定属性的名称时,我收到以下错误。有谁知道此错误消息的含义以及我该如何解决?
UseMethod(“xpathApply”)中的错误:没有适用于“xpathApply”的方法应用于类“c('xml_document','xml_node')”的对象