[R] importing data in excel
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:
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
> PLEASE do read the posting guide!
More information about the R-help