file names under Windows [was: [R] please help me!]

Douglas Bates bates at stat.wisc.edu
Thu Jan 29 21:20:26 CET 2004


If I may make a suggestion, it helps if you use informative subject
lines in your email to a high-traffic list like this.

mpalmier at mines.edu writes:

> hello there, 
>    I'm a new user to R and I am having difficulty reading a file into the 
> program.  Here's the error I keep getting, I bet there's a simple solution, 
> but I cant find any...
> 
> Error in file(file, "r") : unable to open connection
> In addition: Warning message: 
> cannot open file `c:MikeWeather2.txt' 
> 
> I have made sure that my working directory is the same as the place where the 
> file is.  I have also tried using the full path name of the file.  read.table, 
> read.delim, read.csv, and scan have all been attempted with no result.  What 
> causes this message, and how can I fix it.  Thanks in advance for your help,

I always find it tedious to remember how to write file names in
Windows (there are rules about '\' and '/' characters) so I use the
file.choose() function, which brings up a chooser panel.  Although you
haven't said what you want to do with the file, let's assume you are
going to source some R code in the file.  Then you could use

source(file.choose())




More information about the R-help mailing list