[R] read file of EXCEL format

Chuck Cleland ccleland at optonline.net
Thu Feb 23 14:37:42 CET 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.

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




More information about the R-help mailing list