Re: [R] Automatic File Reading

From: Richard M. Heiberger <>
Date: Wed 18 Oct 2006 - 19:17:19 GMT

Wensui Lui asks:
> is there a similar way to read all txt or csv files with same
> structure from a folder?

On Windows I use this construct to find all files with the specified wild card name. I used the "\\" in the file paths with the translate=FALSE, because the "/" in the DOS switches "/w/B" must not be translated. On Windows this picks up both lower and upper case filenames

A similar construct can be written for Unix.

tmp <- shell('dir c:\\HOME\\rmh\\tmp\\*.R /w/B', intern=TRUE, translate=FALSE) ##msdos for (i in tmp) source(paste("c:\\HOME\\rmh\\tmp\\", i, sep="")) mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu Oct 19 05:20:23 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 06:30:14 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.