将多个csv文件写入R

时间:2016-02-08 13:51:15

标签: r csv

我尝试将具有相同数量的列和行的多个csv文件写入多个数据框,可以通过以下方式访问:

file[1] #Outputs the whole content of the first csv file
file[2] #Outputs the whole content of the second csv file

依旧......

我已将所有内容保存到一个数据框中,但无法以这种方式访问​​所需的值:

files = list.files(pattern="*.csv")
myfiles = do.call(rbind, lapply(files, function(x) read.csv(x, stringsAsFactors = FALSE)))

myfiles是一个大数据框架,但我想以我上面解释的方式访问它们。

我正在使用RStudio 0.9,我的工作目录是所有文件所在的位置。 csv文件以这种方式命名: " 001.csv" " 002.csv" " 003.csv" ...

提前谢谢

0 个答案:

没有答案