[R] Importing an Excel file

Richard Müller r.mueller at oeko-sorpe.de
Wed Jul 7 21:21:57 CEST 2004

Am Mittwoch, 7. Juli 2004 20:21 schrieb Park, Kyong H Mr. RDECOM:
> 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.

I import my OpenOffice calc files as follows (OOo or Excel won't make any 
difference, the csv-format is the same):

inp <- (scan(file, sep=";", dec=",", list(0,0), skip = 13, nlines = 58)
x <- inp[[1]]; y <- inp [[2]]

sep=";": column separator ;
dec="," decimal separator ,
list(0,0): first two columns
skip: no of lines to skip (these lines contain comments etc.)
nlines=58: 58 lines of values to plot
hth, Richard
Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
r.mueller at oeko-sorpe.de      -     www.oeko-sorpe.de

More information about the R-help mailing list