Hi Grace, Try something along the lines of
do.call(rbind, lapply(1:maxi, function(x) get(paste('data', x, sep = "")))) HTH, Jorge On Wed, Dec 29, 2010 at 5:06 PM, Li, Grace <> wrote: > Hi there, > > I have a question on how to read a bunch of dataset, assign each of the > dataset to a matrix in the memory, and append them. > > Suppose I have 20 dataset saved to different .rda files named > gradeFileData1, gradeFileData2,...., gradeFileData20. And I would like to > read them each into a dataset in the memory, then combine them. I wrote > something like: > > e1<-new.env(parent=.GlobalEnv) > maxi <- 20 > i <- 1 > while (i<=maxi) { > e1$d <-1 > datanam <- paste("data",i,sep="") > data <- e1$d > names(data)[length(data)] <- datanam > i <- i+1 > } > > The function "names(data)[length(data)]" doesn't seem to work. I need it to > be named like data1,data2,,,,,data20..... > > Also to append them into a big dataset, I think there should be something > simpler than > all <- > rbind(data1,data2,data3,data4,data5,data6,data7,data8.........data20) > > can you help me on this? I hope this is not some simplest R question..... I > am a beginner. > > Thanks a ton! > > Grace > > > Confidentiality Notice: This e-mail message including at...{{dropped:12}} > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.