![](/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.