[R] Excel to R

Gabor Grothendieck ggrothendieck at myway.com
Wed Oct 22 02:31:16 CEST 2003



I have Excel files containing data that I would like to move to R.
They are in the standard form of a one row header followed by 
rows of data, one record per row EXCEPT that there are a few
rows of comments before the header.  The number of rows of comments
varies.  For Excel files of this form without comments I have had
success with:

require(RODBC)
z <- odbcConnectExcel("C:/myspread.xls")
z.df <- sqlFetch(z,"Sheet1")
close(z)

but the comments interfere with this.  

I don't want to manually delete the rows but want the entire
process from Excel file to R to be automatic.

I can accomplish this with a free utility, Baird's dataload that 
I found on the net.  This will convert the Excel files to text 
and then the text can be processed using R to locate the start of 
the header and only process the remainder of the file.  (There is
also another free utility called xlhtml that I don't use, but could 
have, that does this too.) Thus at this point I have an 
adequate automated solution.

Nevertheless, I was wondering, for sake of interest, if there is 
some solution in R that does not involve such an external program
such as dataload or xlhtml.

Thanks.

(I am using Windows 2000.)

_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com




More information about the R-help mailing list