[R] Reading data
Keo Ormsby
keo.ormsby2 at gmail.com
Wed Sep 23 15:08:17 CEST 2009
Hello Ashta,
You need to use double blackslashes, liike: "C:\\Documents and
Settings\\ashta\\MyDocuments\\R_data\\rel.dat"
I usually use the following to avoid writing the path:
#select file from a popup window
f <- file.choose()
#read the file. the .... is Rese for any other arguments e.g. header,
sep. quote, etc.
data <- read.table(f, ...)
Good luck! and welcome to R.
Keo.
Ashta escribió:
> 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.
>
More information about the R-help
mailing list