作者vicror84 (阿汘)
看板R_Language
標題[問題] table問題
時間Sun Jun 5 20:23:26 2016
請問我想把亞東健檢中心(
http://depart.femh.org.tw/HMC/wholebody.html)的表格爬下
來,但會出現亂碼在windows系統中,使用R語言,抓取表格呈現出亂碼,
我們將格式轉為繁體,
還是會呈現亂碼,我們研究出所有BIG5編碼的網頁,轉換後,還是亂碼,
程式如下:
library(XML)
URL = paste0("
http://depart.femh.org.tw/HMC/wholebody.html")
doc<-htmlParse(URL,encoding="UTF-8")
tables<-readHTMLTable(doc,header=T,which = 2)
tables
dim(tables)
View(tables)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.42.187.234
※ 文章網址: https://webptt.com/m.aspx?n=bbs/R_Language/M.1465129416.A.876.html