[R-sig-DB] rmysql and strings containg \n

H. Felix Wittmann h|w|ttm@nn @end|ng |rom goog|em@||@com
Tue Oct 13 23:57:00 CEST 2009


let me start by saying RMySQL is a wonderful package of a superb
language:R.  One particular feature I cant seem to get rid of easily
is the hadling of  \n in strings. Is there an easy solution to this?

H. Felix Wittmann

PS : What follows is some code, demonstrating the problem

require(RMySQL)

m <- dbDriver("MySQL")
myCon <- dbConnect(m,dbname = "myDatabase"))  ## replace myDatabase by
what is appropriate for you


test <- data.frame(id=1,myString='beginning1 \n end1')


> dbWriteTable(myCon,name='test', value=test)
[1] TRUE

> dbReadTable(myCon,name='test')
      id    myString
1      1 beginning1
 end1 NA        <NA>

> testOut<- dbReadTable(drupal5,name='test')
> dim(testOut)
[1] 2 2

> dim(test)
[1] 1 2




More information about the R-sig-DB mailing list