Hi, 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)))) A.K. Hello, 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 ? Than you ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.