[R] loop through files in a dir

Jeff Gentry jgentry at jimmy.harvard.edu
Fri Mar 19 22:51:32 CET 2004


> I have data in many files in a directory, how can I
> loop through the files in a given dir in-order-to
> build a data.frame? 

Just use something like 'x <- dir(YOUR_ARGS_HERE)', and then you can do a
loop like:

for (i in x) {
  do something
  do something else
  etc ...
}

-J




More information about the R-help mailing list