[問題] 使用 rvest 套件,爬不出表格內容

看板R_Language作者 (茹莎)時間9年前 (2016/07/07 11:57), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
想要使用 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://www.ptt.cc/bbs/R_Language/M.1467863878.A.B62.html

07/07 13:11, , 1F
html_nodes("#table15")
07/07 13:11, 1F

07/07 21:06, , 2F
文章代碼(AID): #1NVTD6jY (R_Language)
文章代碼(AID): #1NVTD6jY (R_Language)