Skip to content
Prev 460 / 1559 Next

Unwanted carriage returns storing dataframes with dbWriteTable

I suspect this is related to the similar problem seen in RSQLite by the 
same author, Cc:ed here :

https://stat.ethz.ch/pipermail/r-help/2007-January/122998.html
https://stat.ethz.ch/pipermail/r-sig-db/2007q1/000248.html

There is a function RMySQL:::mysqlWriteTable that has

    sql4 <- paste("LOAD DATA LOCAL INFILE '", fn, "'",
                   " INTO TABLE ", name,
                   " LINES TERMINATED BY '\n' ", sep="")

I believe that \n needs to be \r\n on Windows. See 
http://dev.mysql.com/doc/refman/5.0/en/load-data.html .  The alternative 
is to alter RMySQL:::safe.write to work with a binary file.
On Tue, 12 Aug 2008, Hansruedi Baetschmann wrote: