Mindy- > > If the sub-directories are named in a structured way --- say sd1, sd2, > sd3, ..., sd100 --- then one option is a simple for-loop. Something like > the code below. > > -tgs > > directory.path <- '~/blahblah/' # or 'C:/blahblah/' for windows > sd.names <- paste(directory.path,'sd',1:100,sep="") > output <- array(NA, dim=c(100, number.of.statistics) ) > > for( i in 1:100){ > setwd(sd.names[i]) > > ... Code to read file, and calculate stats ... > ... Code to store stats in output array ... > > } > > > > > On Thu, Dec 6, 2012 at 1:13 PM, Min Dong <mindyd...@gmail.com> wrote: > >> Hi, everyone: >> >> >> >> I have multiple dataset (say 100) in different subdirectory. They have >> same >> name and exactly same format. I want to get summary for some columns for >> each of these dataset (such as mean, SD etc), and list the summary in one >> output file. It is for sure not effective if I do this one by one. Can >> anyone advise me how to do it on the fly using R? >> >> >> >> More specifically, I wish to accomplish 2 jobs: >> >> 1), Import those 100 dataset to R. I will then have 100 data frames. >> >> 2), Analyze these 100 data frames simultaneously. >> >> >> >> I am a newbie for R. Any suggestion would be greatly appreciated. >> >> >> >> Thank you very much. >> >> >> >> Mindy >> >> [[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. >> >> >
[[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.