Xml 使用R从covers.com中抓取数据时出错
我正在尝试使用R从网站上抓取数据。我是抓取数据的新手 我的代码如下:Xml 使用R从covers.com中抓取数据时出错,xml,r,Xml,R,我正在尝试使用R从网站上抓取数据。我是抓取数据的新手 我的代码如下: library(XML) url1<-"http://www.covers.com/sports/NCAAB/matchups?selectedDate=2015-02-28" data1<-htmlTreeParse(url1) getNodeSet(data1,"//div[@class = 'data-competition-type']") 为什么我会得到这个?我将
library(XML)
url1<-"http://www.covers.com/sports/NCAAB/matchups?selectedDate=2015-02-28"
data1<-htmlTreeParse(url1)
getNodeSet(data1,"//div[@class = 'data-competition-type']")
为什么我会得到这个?我将非常高兴能得到任何帮助。非常感谢。
getNodeSet
有一个doc
参数,根据帮助页面(请参阅),该参数应为“
XMLInternalDocument类的对象。“
您得到该错误是因为您的
data1
对象不是类“XMLInternalDocument”的对象;它是一个“XMLDocumentContent”类的对象getNodeSet
有一个doc
参数,根据帮助页面(请参阅),该参数应为“
XMLInternalDocument类的对象。“
您得到该错误是因为您的
data1
对象不是类“XMLInternalDocument”的对象;它是类“XMLDocumentContent”的对象,基本上,切换到htmlpasse
基本上,切换到htmlpasse
Error in UseMethod("xpathApply") :
no applicable method for 'xpathApply' applied to an object of class "XMLDocumentContent"