R is not able to cope with null-strings (\\0) in characters, does anyone know how to handle this? More concrete, I want to store complex R objects within a database using an
You need
stringModel <- as.character(serialModel)
for a character representation of the raw bit codes. rawToChar will try to convert the raw bit codes, which is not what you want in this case.
The resulting stringModel can be converted later on back to the original model by :
newSerialModel <- as.raw(as.hexmode(stringModel))
newModel <- unserialize(newSerialModel)
all.equal(model,newModel)
[1] TRUE
Regarding the writing of binary types to databases through RODBC : as for today, the vignette of RODBC reads (p.11) :
Binary types can currently only be read as such, and they are returned as column of class "ODBC binary" which is a list of raw vectors.