[R] Error on reading an excel file

anna_l lippelanna21 at hotmail.com
Mon Nov 16 19:08:25 CET 2009


Thanks Charlie, well yes it included one row with two NA datas. I guess there
is an explanation, let´s wait and see if someone knows more about it :)


cls59 wrote:
> 
> 
> anna_l wrote:
>> 
>> Hello everybody, here is the code I use to read an excel file containing
>> two rows, one of date, the other of prices:
>> library(RODBC)
>> 	z <- odbcConnectExcel("SPX_HistoricalData.xls")
>> 	datas <- sqlFetch(z,"Sheet1")
>> 	close(z)
>> It works pretty well but the only thing is that the datas stop at row
>> 7530 and I don´t know why datas is a data frame that contains 7531 rows
>> with the last two ones = NA...
>> 
> 
> I find this occurs sometimes when I export an Excel worksheet to CSV. 
> Excel will include one or more rows of blank cells after the data stops. 
> I would imagine the behavior you are seeing with RODBC is due to the same
> issue.
> 
> I don't know if there is anything that can be done about it other than to
> trim your dataset back to the appropriate length once it gets into R.
> 
> 
> Good luck!
> 
> -Charlie
> 


-----
Anna Lippel
new in R so be careful I should be asking a loooooooot of questions!:teeth:
-- 
View this message in context: http://old.nabble.com/Error-on-reading-an-excel-file-tp26371750p26376656.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list