[R] rbind multiple data sets (.csv)
smartpink111 at yahoo.com
Wed Jun 11 16:42:51 CEST 2014
If your working directory is "data 3" which has only two folders C1 and C2.
May be this helps:
lsF1 <- list.files(recursive=TRUE)
lst1 <- lapply(split(lsF1,gsub(".*\\_(\\d+)\\..*","\\1",lsF1)),function(x) do.call(rbind,lapply(x,function(y) read.csv(y, header=TRUE))))
I am trying to rbind two data sets into one data set.But my two data sets are from different folders, which are C:\Users\yw12\Desktop\data 3\C1 and C:\Users\yw12\Desktop\data 3\C2. And each folder has 100 data sets. In the C1 folder, it has C1_1,C1_2,...,C1_100;in the C2 folder , it has C2_1,C2_2,...,C2_100.
I want to rbind C1_1 vs C2_1,C1_2, vs C2_2,....
All of data sets are .csv.
How can I do that ?
More information about the R-help