[R] importing data in excel

ronggui wong 0034058 at fudan.edu.cn
Mon Aug 30 10:22:39 CEST 2004


if under  windows ,the command works well,but under linux ,it does NOT,as 
linux can keep couples of file in clipboar.so i want to know how to do 
similar thing under linux.anyone knows?    

the erroe msg is as follow:
> dat<-read.table('clipboard',header=T)
Error in file(file, "r") : unable to open connection
In addition: Warning message:
cannot open file `clipboard'


ÔÚ 2004 °ËÔÂ 30 ÐÇÆÚÒ» 15:21£¬Thomas Petzoldt Ð´µÀ£º
> Uwe Ligges wrote:
> > Gerardo Prieto Blanco wrote:
> >> Hello, I need to care excel data to be used
> >> in R,..., how do I make it?
> >> Thank you and greetings, Gerardo Prieto
> >
> > Please read the R Data Import/Export manual!
> >
> > Uwe Ligges
>
> Hello Gerardo,
>
> I completely agree with Uwe, and the following simple example may help:
>
> 1.) Create a rectangular area in Excel like this:
>
> no	treat	val
> 1	a	1
> 2	a	5
> 3	b	3
> 4	b	3
> 5	b	2
>
> 2.) Mark and Copy these cells including the first row
> => the data are now in the so-called "Windows Clipboard"
>
> 3.) Switch to R and provide the following command (by typing it!, not by
>
> copy and paste, because the clipboard already contains the data):
> > dat <- read.table("clipboard", header=TRUE)
>
> Now, the data are in dat and you can inspect them using:
> > dat
>
> or better
>
> > str(dat)
>
> Hints: depending on your configuration some additional options may be
> necessary in read.table, e.g. sep="\t" (if your data contain empty
> cells) or dec="," (on some non-English languages, e.g. German).
> Furthermore there are many other ways to import data, see the manual.
>
> Thomas P.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list