[R] Importing an Excel file
MSchwartz at MedAnalytics.com
Wed Jul 7 20:44:44 CEST 2004
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.
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
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.
More information about the R-help