![](/img/trans.png)
[英]Scraping with rvest -- data has <table> tag but not found with html_table()
[英]Coercing rvest to recognize tables (html_tag(x) == “table” is not TRUE)
我似乎无法让html_table()
工作。
这是一个很好的例子:(试图刮掉6场比赛:桌子)
library(rvest)
hockey <- html("http://www.hockey-reference.com/boxscores/2015/3/6/")
hockey %>%
html_nodes("#stats .tooltip , #stats td , #stats a") %>%
html_table()
但是我得到一个html_tag(x) == "table" is not TRUE
。 它显然是一张桌子。
我怎样才能强迫rvest将节点识别为一个表?
尝试:
hockey %>% html_table(fill = TRUE)
解析页面上的所有表格,或
hockey %>% html_nodes("#stats") %>% html_table()
解析你所追求的第一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.