我正在尝试读取多个文件,然后将它们组合成一个数据框。我正在使用的代码如下:
library(plyr)
mydata = ldply(list.files(path="Data load for stations/data/Predicted",pattern = "txt"), function(filename) {
dum = read.table(filename,skip=5, header=F, sep=" ")
#If you want to add the filename as well on the column
dum$filename = filename
return(dum)
})
我得到的错误如下:
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'mobdata201001.txt': No such file or directory
数据文件可在https://www.dropbox.com/sh/827kmkrwd0irehk/BFbftkks42上找到
非常感谢任何帮助。