is there a similar way to read all txt or csv files with same structure from a folder?
thanks. On 10/18/06, Jerome Asselin <[EMAIL PROTECTED]> wrote: > On Wed, 2006-10-18 at 17:09 +0200, Lorenzo Isella wrote: > > Dear All, > > I am given a set of files names as: > > velocity1.txt > > velocity2.txt > > and so on. > > I am sure there must be a way to read them automatically in R. > > It is really taking me longer to read them than to analyze them. > > Anybody has a suggestion to help me out with this? > > Many thanks > > Not what you mean by "reading". > ?read.table > ?read.csv > ?scan > ... > > However, consider this example. If you have 100 files, you can do: > > for(i in 1:100) > { > fn <- paste("velocity",i,".txt",sep="") > dat <- read.csv(fn) > # ... do your stuff on "dat" here ... > } > > HTH, > Jerome > > -- > Jerome Asselin, M.Sc., Agent de recherche, RHCE > CHUM -- Centre de recherche > 3875 rue St-Urbain, 3e etage // Montreal QC H2W 1V1 > Tel.: 514-890-8000 Poste 15914; Fax: 514-412-7106 > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > -- WenSui Liu (http://spaces.msn.com/statcompute/blog) Senior Decision Support Analyst Cincinnati Children Hospital Medical Center ______________________________________________ R-help@stat.math.ethz.ch 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.