How to convert csv to xls using R?

前端 未结 1 1226
野趣味
野趣味 2021-01-06 22:14

I have a folder with few hundred CSV files. What would be the easiest way to convert these to XLS format using R?

(Yes, I know CSV is Excel-compatible but I still ha

相关标签:
1条回答
  • 2021-01-06 22:46

    Use the package xlsReadWrite to export to xls:

    library(xlsReadWrite)
    filenames <- list.files("[path_name]", pattern="*.csv", full.names=TRUE)
    for(i in 1:length(filenames)){
        a <- read.csv(filenames[i])
        write.xls(a, paste("file",i,".xls", sep=""))
    }
    
    0 讨论(0)
提交回复
热议问题