将列添加到下载的xlsx文件中

时间:2016-05-26 17:18:01

标签: r download xlsx

我想为我的数据列的每一行下载一个xlsx文件。为此,我写道:

    library(RCurl)
    u = read.table("Mydata.txt" , header = TRUE)

    res = list()
    for(i in 1:nrow(u) ){
      # For each row it goes to this url and download it's file
     MyURL<-"URL"
     # The Name of the file 
      dir = paste(u$V1[i], "_",i , ".xlsx" , sep="")
      # Downloading the file 
      tables <-download.file(MyURL, destfile= dir , mode="wb") 
#Reading the downloaded file
  excel.file<-read.xlsx(dir,1)
      # Counting the list 
      print(i)
          Sys.sleep(0.05)
}

问题是我想在下载的文件中添加一列,该列的所有单元格中的值应该是我下载它的文件的值意味着u$V1[i]然后保存它。下载后我读了它但我不知道怎样才能在这个文件中添加这样的列?

0 个答案:

没有答案