Loading data from Excel file into R or Octave

Alphaneo picture Alphaneo · Jul 29, 2009 · Viewed 12.4k times · Source

I have an Excel file with a large set of data. The built-in graphs available in Excel are not enough to analyze these data, so I am thinking about using some tool like octave or R.

I was thinking about some method to load an Excel file directly into octave or R. I searched the web and found that many people have succeeded using by exporting data from Excel into a CSV file.

The question: Is there a direct way to load an Excel file in R or Octave?

Answer

duffymo picture duffymo · Jul 29, 2009

Yes, here's how:

Windows users can use odbcConnectExcel in package RODBC. This can select rows and columns from any of the sheets in an Excel spreadsheet file (at least from Excel 97–2003, depending on your ODBC drivers: by calling odbcConnect directly versions back to Excel 3.0 can be read). The version odbcConnectExcel2007 will read the Excel 2007 formats as well as earlier ones (provided the drivers are installed: see RODBC).