作者lusa (茹莎)
看板R_Language
标题[问题]使用 rvest 套件,爬不出表格内容
时间Thu Jul 7 11:57:55 2016
想要使用 rvest套件,爬出此网页的table
此网页:
http://app.tzuchi.com.tw/tzuchi/About_TP_Center/?ContentType=6&IdentityID=130
刚申请进入这里,第一次发文
小妹初步学习R语言,希望浅显易懂,能够更加了解使用方法。
程式码如下:
library(rvest)
webpage <-
html("
http://app.tzuchi.com.tw/tzuchi/About_TP_Center/?ContentType=6&IdentityID=130")
webpage <- iconv(webpage,from="UTF-8",to="UTF-8")
data <- webpage %>% html_nodes("table[@id='table15']") %>% .[[1]] %>% html_table()
使用这样程式码却爬不出来,是甚麽原因呢?
跑出错误讯息是:
Error in UseMethod("xml_find_all") :
no applicable method for 'xml_find_all' applied to an object of class
"character"
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 120.96.63.147
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1467863878.A.B62.html
1F:推 howard40116: html_nodes("#table15") 07/07 13:11