[R] reading text file in Windows (was no subject)

Gabor Grothendieck ggrothendieck at myway.com
Wed Jul 14 19:03:43 CEST 2004

John Fox <jfox <at> mcmaster.ca> writes:

> You got several useful suggestions for what you may have done wrong. I often
> find that it's easier to use read.table(file.choose()) and to navigate to
> the file in the resulting dialog than to type the path to the file.

Related to this, you could issue the command exactly as shown without
any arguments at all:


from the R console, navigate to the correct file and it will return the
correct text representation of the filename to use in your read.table.

For example, below I navigated to the AUTHORS file in the rw1091
R distribution:

   R> file.choose()
   [1] "C:\\Program Files\\R\\rw1091\\AUTHORS"

This should help you decipher whether you got the path wrong, the filename
wrong, etc.

More information about the R-help mailing list