Re: [R] Importing an Excel file

From: Marc Schwartz <>
Date: Thu 08 Jul 2004 - 04:44:44 EST

On Wed, 2004-07-07 at 13:21, Park, Kyong H Mr. RDECOM wrote:
> Hello, R users,
> I am a very beginner of R and tried read.csv to import an excel file after
> saving an excel file as csv. But it added alternating rows of fictitious NA
> values after row number 16. When I applied read.delim, there were trailing
> several commas at the end of each row after row number 16 instead of NA
> values. Appreciate your help.
> Kyong

Yep. This is one of the behaviors that I had seen with Excel when I was running Windows XP. Seemingly empty cells outside the data range would get exported in the CSV file causing a data integrity problem.

It is one of the reasons that I installed OpenOffice under Windows and used Calc to open the Excel files and then do the CSV exports before I switched to Linux.... :-)

Depending upon the version of Excel you are using, you might try to highlight and copy only the rectangular range of cells in the sheet that actually have data to a new sheet and then export the new sheet to a CSV file.

Do not just click on the upper left hand corner of the sheet to highlight the entire sheet to copy it. Only highlight the range of cells you actually need for copying.

Another option is to use the read.xls() function in the 'gregmisc' package on CRAN or install OpenOffice.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide! Received on Thu Jul 08 04:48:44 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:34:53 EST