我在一个文件夹中有很多数据
data=list.files(path="D:/result")
数据
> > [1] "CNVWorkShop (1).txt" "e17 result.txt" [3] "E17new result.txt" "E18 NEW RESULT.txt"
>
> [5] "e18result.txt" "l15 new result.txt" [7] "l15
> result.txt" "L22NEW RESULT.txt" [9] "L51 NEW RESULT.txt"
> "l51result.txt" [11] "L54 NEW RESULT.txt" "L54result.txt"
> [13] "PennCNV.txt" "s40 new result.txt"
我想一次读取多个文件并将每个文件存储为每个数据帧
a=paste("watto",1:14,sep="")
我在下面做这件事,但它不起作用
for(i in 1 :length(data)){
a[i]=read.table(file=paste("D:/result/",data[i],sep=""),header=T,sep="\t")
}
它显示警告消息而不给我结果
> Warning message:
In a[1] = read.table(file = paste("D:/result/", data[1], sep = ""), :
number of items to replace is not a multiple of replacement length
我想要的结果是
> data from watto1 come from CNVWorkShop (1).txt
> data from watto2 come from e17 result.txt
我该怎么办?