我舉一例做為說明,以下是r的code碼:
#抓取"http://www.google.com/adplanner/static/top1000/"的數據
library(XML) #您要先裝XML的套件
google="http://www.google.com/"
path="adplanner/static/top1000/"
top1000s=paste(google,path,sep="") #將html資料先用top1000s命名
table=readHTMLTable(top1000s) #讀入r中,並以table命名
top1000=table[[2]] #將html資料的欄位資料取出,並命名為top1000
colnames(top1000)=c('rank','site','category','user','reach','view','advertising') #重新對top1000的欄位命名
head(top1000) #查看top1000的前六筆資料