[R] Importing an Excel spreadsheet

ken knoblauch knoblauch at lyon.inserm.fr
Thu Mar 20 23:33:13 CET 2008


andy <geek_show <at> dsl.pipex.com> writes:
> I am trying to import an *.xls spreadsheet into R. I am doing this as 
> follows:
>  > read.table(file("A5_DL.xls"))
> So I copied it all over to a text document and tried to import that, thus:
>  > read.table("A5.txt")
> The error I got then was:
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, 
> na.strings, :
> line 26 did not have 34 elements
> Having gone over the line in question, it all seems to be the same as 
> any other row. I really don't want to have to manually re-enter the data 
> (some 98 rows x 26 columns).
> Thanks
> 
> Andy
read.table deduces that your data set has 34 elements, not 26, according to 
the error message.  Could there be spaces in the column names?

ken



More information about the R-help mailing list