read file of EXCEL format

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

read file of EXCEL format

XinMeng

Hello sir:

How can I read data file of EXCEL format from disk("d:\\data.XLS" for example)?

I can only read data file of .txt format
read.delim("d:\\data.txt",header=T,as.is=T),but only EXCEL format is available at present.


Thanks a lot

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: read file of EXCEL format

Chuck Cleland
XinMeng wrote:
> Hello sir:
>
> How can I read data file of EXCEL format from disk("d:\\data.XLS" for example)?
>
> I can only read data file of .txt format
> read.delim("d:\\data.txt",header=T,as.is=T),but only EXCEL format is available at present.

Here is one way to read it directly:

library(RODBC)

z <- odbcConnectExcel("d:/data.xls")
       mydata <- sqlFetch(z, "Sheet1")
       close(z)

# Replace Sheet1 with the name of the worksheet to be read.

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: read file of EXCEL format

Sean Davis
In reply to this post by XinMeng
http://cran.r-project.org/doc/manuals/R-data.html#Reading-Excel-spreadsheets


On 2/23/06 8:49 AM, "XinMeng" <[hidden email]> wrote:

>
> Hello sir:
>
> How can I read data file of EXCEL format from disk("d:\\data.XLS" for
> example)?
>
> I can only read data file of .txt format
> read.delim("d:\\data.txt",header=T,as.is=T),but only EXCEL format is available
> at present.

Reading the manual is quite helpful for such things:

http://cran.r-project.org/doc/manuals/R-data.html#Reading-Excel-spreadsheets

Sean

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: read file of EXCEL format

Prof Brian Ripley
In reply to this post by XinMeng
Please see the 'R Data Import/Export Manual' which ships with every copy
of R.

On Thu, 23 Feb 2006, XinMeng wrote:

> Hello sir:
>
> How can I read data file of EXCEL format from disk("d:\\data.XLS" for example)?
>
> I can only read data file of .txt format
> read.delim("d:\\data.txt",header=T,as.is=T),but only EXCEL format is available at present.

> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

PLEASE do!


--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: read file of EXCEL format

Bady-2
In reply to this post by XinMeng
hi, hi all,

there are several possibilities to import data in Excel format.
you can use the fonctions "odbcConnectExcel","read.xls", ...
(see http://cran.r-project.org/doc/manuals/R-data.html)

require(RODBC)
?odbcConnect

library(gdata)
?read.xls


regards,


P.BADY



Selon XinMeng <[hidden email]>:

>
> Hello sir:
>
> How can I read data file of EXCEL format from disk("d:\\data.XLS" for
> example)?
>
> I can only read data file of .txt format
> read.delim("d:\\data.txt",header=T,as.is=T),but only EXCEL format is
> available at present.
>
>
> Thanks a lot
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>




--------------------------------------------------------------------------
Ce message a été envoyé depuis le webmail IMP (Internet Messaging Program)

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html