[R] How to read Excel file and access the data item?

Gabor Grothendieck ggrothendieck at myway.com
Thu Mar 4 01:08:35 CET 2004


There are a number of ways to do this:

1. select range including headers in Excel and
copy to clipboard (via ctrl-C) and in R:
mydata <- read.table("clipboard", header=T)

2. In Excel File | Save As and select csv as type.  In R:
mydata <- read.csv("/myfile.csv")

3. RODBC package
This package implements a Microsoft ODBC connection.

e.g.
      require(RODBC)
      z <- odbcConnectExcel("dd.xls")
      dd <- sqlFetch(z,"Sheet1")
      close(z)

4. RDCOMClient package

See http://www.omegahat.org/RDCOMClient/ 
This packages implemented a Microsoft COM connection.

5. Thomas Baier's R COM package

http://sunsite.univie.ac.at/rcom/
Similar to RDCOMClient.

6. Third party utilities

There are a number of free utilities for converting from
Excel to csv that you can find via googling.  

---
Date:   Wed, 3 Mar 2004 11:25:24 -0800 (PST) 
From:   Grace Conlon <gracestat at yahoo.com>
To:   <R-help at stat.math.ethz.ch> 
Subject:   [R] How to read Excel file and access the data item? 

 
In R, How to read Excel file and access the data item?
Thank you.




More information about the R-help mailing list