[R] Reading multiple files into R

Witold Eryk Wolski wolski at molgen.mpg.de
Fri Oct 1 09:13:16 CEST 2004

There is a function ?dir which returns you the content of the dir_ectory.
If this is more then there is a function ?grep which allows you to 
extract relevant items.
If you need to postprocess the names you have a function ?paste for example.
And finally you have an S language construct for(){}
And there is help.search() and An Introduction to R to which tells you 
how to write functions.


Vikas Rawal wrote:

> I want to read data from a number of files into R.
> Reading individual files one by one requires writing enormous amount 
> of code that will look something like the following.
> ****************
> maptools:::dbf.read("wb-01vc.dbf")->dist1
> maptools:::dbf.read("wb-02vc.dbf")->dist2
> maptools:::dbf.read("wb-03vc.dbf")->dist3
> maptools:::dbf.read("wb-04vc.dbf")->dist4
> maptools:::dbf.read("wb-05vc.dbf")->dist5
> maptools:::dbf.read("wb-06vc.dbf")->dist6
> maptools:::dbf.read("wb-07vc.dbf")->dist7
> maptools:::dbf.read("wb-08vc.dbf")->dist8
> maptools:::dbf.read("wb-09vc.dbf")->dist9
> *****************
> Is there a better way of doing this?
> Vikas
> ______________________________________________
> R-help at 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

Dipl. bio-chem. Witold Eryk Wolski         
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin           _
tel: 0049-30-83875219                   'v'
http://www.molgen.mpg.de/~wolski       /   \
mail: witek96 at users.sourceforge.net  ---W-W----
      wolski at molgen.mpg.de

More information about the R-help mailing list