ファイルのダウンロード

#path
username<-Sys.info()['user']
path01<-paste("C:/Users/",username,"/Desktop/R_Data_Read/",sep="")
path02<-paste("C:/Users/",username,"/Desktop/R_Graph/",sep="")
path03<-paste("C:/Users/",username,"/Desktop/R_Data_Write/",sep="")
#url
url<-c(
"http://www.mof.go.jp/english/jgbs/reference/interest_rate/historical/jgbcme_all.csv",
"http://www.mof.go.jp/english/jgbs/reference/interest_rate/jgbcme.csv",
"http://www.meti.go.jp/statistics/tyo/iip/xls/b2010_gsm1j.xls"
)
setwd(path01)
for(iii in 1:length(url)){
 n.file<-nchar(url[iii])
 for(nnn in n.file:1){
  if(substr(url[iii],nnn,nnn)=="/"){
   filename<-substr(url[iii],nnn+1,n.file)
   break
  }
 }
 download.file(url[iii],filename,mode="wb")
}