[R] Exporting a data.frame to excel using sqlSave - adds a character ' to values

Juliette Fabre juliette_fabre at yahoo.fr
Tue Mar 27 17:08:49 CEST 2012


Hello, 

I encountered a situation similar as the one described by Tal above :

I use the RODBC library to export multiple dataframes into different sheets
of an Excel file.
My dataframes contain Character, Date and Numeric columns.

library("RODBC")
channel <- odbcConnectExcel(xls.file = myXlsFile, readOnly = FALSE)
sqlSave(channel, data, tablename = "Table1", rownames = F, colnames = T)
odbcClose(channel)

When exported into Excel, *all * of my cells start with the ' character
(which is different from Tal's situation where *only * non-numeric cells
started with ' character).
I need the columns that contain numeric data or dates to be imported into
the appropriate format so that they can be manipulated (graphics etc).

I found a macro that formats all the sheets in the appropriate way, but I
would like to discover why even my numeric data (type Numeric in R)  are
imported as text.

Regards, 

Juliette




--
View this message in context: http://r.789695.n4.nabble.com/Exporting-a-data-frame-to-excel-using-sqlSave-adds-a-character-to-values-tp1016523p4509108.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list