[R] Reading data

Don MacQueen macq at llnl.gov
Wed Sep 23 16:26:05 CEST 2009


What it is telling you is that it can't find the file. This could be 
because the file isn't there, or you've got a typo in the file name, 
that sort of thing.

In your email, you have split the filename argument between two 
lines. I don't know whether this comes from what you did in R, or 
whether it was put there by the email software. If the former, try it 
without the line break, like this:

rel <- read.table("C:/Documents and Settings/ashta/My 
Documents/R_data/rel.dat",
  quote="",header=FALSE,sep="",col.names=
   c("id","orel","nrel"))

NOT

rel <- read.table("C:/Documents and Settings/ashta/My
Documents/R_data/rel.dat",
  quote="",header=FALSE,sep="",col.names=
   c("id","orel","nrel"))


This is a bit of a wild guess, since I don't use R in Windows, and I 
don't know how the R GUI for Windows handles a line break in the 
filename in context of read.table(). But it could be the problem. 
Also, isn't there supposed to be a space between "My" and 
"Documents"? As best I can tell from your email, you don't have one 
-- but it's hard to tell because it's split into two lines.

-Don

At 8:42 AM -0400 9/23/09, Ashta wrote:
>Dear R-users,
>
>  I am a new user for R. I am eager to lean about it.
>
>
>
>I wanted to read and  summary of the  a simple data file
>
>
>
>I used the following,
>
>
>
>
>
>rel <- read.table("C:/Documents and Settings/ashta/My
>Documents/R_data/rel.dat", quote="",header=FALSE,sep="",col.names=
>
>c("id","orel","nrel"))
>
>summary(rel)
>
>
>
>
>
>Below is the error message,
>
>
>
>rel <- read.table("C:/Documents and Settings/ashta/My
>Documents/R_data/rel.dat", quote="",header=FALSE,sep="",col.names=
>
>+ c("id","orel","nrel"))
>
>Error in file(file, "r") : cannot open the connection
>
>In addition: Warning message:
>
>In file(file, "r") :
>
>   cannot open file 'file=C:/Documents and Settings/sewalem/My
>Documents/R_data/rel.dat': Invalid argument
>
>>  summary(rel)
>
>Error in summary(rel) : object 'rel' not found
>
>
>
>Does it need a library? Where can I get the library?
>
>
>
>Any help is highly appreciated
>
>
>
>Ashta
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://*stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062




More information about the R-help mailing list