draft/getMitsubishi.R

getMitsubishi <- function(){
  URL='http://www.5230.com.tw/index.php/Salemall/salemallList'
  res <- GET(URL, encoding='utf8')
  html <- htmlParse(content(res, "text", encoding = "utf8"), encoding = "utf8")
  table <- readHTMLTable(html)
  wantData=table[[1]][c(14:175),c(1,2,3,5)]
  wantData[,3]=str_replace_all(wantData[,3],'\t','')
  wantData[,4]=str_replace_all(wantData[,4],'\t|\n| ','')
  colnames(wantData)=c('name','zone','addrs','tel')
  row.names(wantData)=c(1:162)
  wantData=wantData[,c(2,1,3,4)]
  return(result=data.frame(brand_nm='三菱汽車',store_nm=wantData$name,zone=wantData$zone,addr=wantData$addr,tel_no=wantData$tel, stringsAsFactors = FALSE))
}
leoluyi/CRMaddress documentation built on May 21, 2017, 11:41 a.m.