2015-03-02 58 views
1

我想读位于本网站为R的数据和文本分析的信息:读取HTML代码为R的数据和文本挖掘

http://www.nhl.com/scores/htmlreports/20142015/PL020916.HTM 

我曾尝试使用阅读源代码成R下面的包和代码:

library(XML) 
theurl <- "http://www.nhl.com/scores/htmlreports/20142015/PL020916.HTM" 
tables <- readHTMLTable(theurl) 

con = url("http://www.nhl.com/scores/htmlreports/20142015/PL020916.HTM") 
htmlCode=readLines(con) 
close(con) 
htmlCode 

我要寻找的输出是提供的信息的平面文件。

+0

我不使用R,但今天看到了一些关于这一点的信息,这可能是你要找的东西:https://github.com/hadley/rvest – nvioli 2015-03-02 21:28:19

回答

0

我不知道你是从你提供的页面找什么信息的,但这里是你如何可以使用rvest阅读...

url <- "http://www.nhl.com/scores/htmlreports/20142015/PL020916.HTM" 
library("rvest") 
url %>% html()