[R] process all files ending in *.dat
Roger Bivand
Roger.Bivand at nhh.no
Mon Aug 13 19:06:10 CEST 2001
On Mon, 13 Aug 2001, Paul E Johnson wrote:
> On Linux (RH7.1) with R installed from CRAN rpms:
>
> I have many files with miscellaneous names *.dat. I would like to
> successively open each one, run some functions on them, and then write
> some output numbers to *.summary. I have succeeded in doing this when I
> type in each file name individually for the data input, but have not
> found a way to search files in a directory and grab the *.dat. If
> somebody could tell me syntax or example of how to find the files, and
> get the basename in order to create the new file name, I would be
> grateful.
>
> I tried
> mydat<-system("ls *.dat")
> but mydat does not catch the return.
> Thanks for your many helps in the past...
>
list.files(pattern="*.dat") may help?
Roger
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
and: Department of Geography and Regional Development, University of
Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list