[R] importing data in excel
thpe at hhbio.wasser.tu-dresden.de
Mon Aug 30 09:21:00 CEST 2004
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
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:
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.
More information about the R-help