[R] Reading data

Jim Lemon jim at bitwrit.com.au
Thu Sep 24 10:56:57 CEST 2009


On 09/23/2009 10:42 PM, 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?
>
>
>    
Hi Ashta,
If you have checked that the file "rel.dat" is really there where you 
think it is, there is a nasty trick that Windows plays with many files. 
For example, if you have created this file in Notepad and saved it, you 
may find that .txt has been added to the filename. So the real filename 
is "rel.dat.txt". Of course, Windows won't show you that unless you go 
into Folder Options in Windows Explorer and turn off that "Hide known 
extensions" option. This is a wild guess, but it has happened to me so 
often that I am wary of it.

Jim




More information about the R-help mailing list