Just a little caveat concerning the use of the clipboard to transfer data from 
excel to R:

If I remember right, at least up to Excel 2003, copying data from a worksheet 
(Edit/Copy) to the windows clipboard, copies the data in the number format in 
which they are seen in Excel. That is, if you formatted your data to be easy to 
read (for example, you formated 12.3456 to 12.3), the 12.3 (and not the 
original number) will be copied to the clipboard. When you then get the data 
into R (via read.delim or delim2), 12.3 will be the number which will be 
transferred. This is a little peculiar, since if you paste what you copied into 
a different worksheet (instead of R) you recover all decimals ... but this uses 
the office clipboard ...

So, if you wish to use the clipboard trick, first remove all number formats, 
then copy ... 

Have a nice day,

Chris. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Peter Dalgaard
Sent: Thursday, 19 April, 2007 2:39 PM
To: John Field
Cc: Schmitt, Corinna; [email protected]
Subject: Re: [R] importing excel-file


John Field wrote:
> Corinna,
>
> I find the easiest way to read simple Excel files (under Windows) is 
> to highlight the section of the worksheet I want to read, copy it to 
> the clipboard, and then use
>
> data <- read.delim("clipboard")
>
> You will also need  the parameter dec="," to set the decimal point.
>   
Or use read.delim2, which is what it is for.
> Regards,
> John Field
> Adelaide, SA
>
>
>
> Message: 23
> Date: Wed, 18 Apr 2007 16:10:51 +0200
> From: "Schmitt, Corinna" <[EMAIL PROTECTED]>
> Subject: [R] importing excel-file
> To: <[email protected]>
> Message-ID:
>          <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
> Dear R-experts,
> It is a quite stupid question but please help me. I am very confuced. I
> am able to import normal txt ant mat-files to R but unable to import
> .xls-file
> I do not understand the online help. Can please anyone send me the
> corresponding command lines? The .xls-file is attached. In my file we
> use commas for the decimal format (example: 0,712), changes might be
> needed.
> Thanks, Corinna
>
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] 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.
>   


-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] 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.

______________________________________________
[email protected] 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.

Reply via email to