[R] Problem with serialization via readRDS() on a textConnection()
Christopher Walker
cwalker at illuminateed.net
Tue Aug 8 22:39:19 CEST 2017
Hi All,
I had working code under R v3.2 that serialized an object, stored the
serialized object in a database, and then successfully retrieved and
hydrated that object.
I recently updated to R v3.4.1 and the same code now fails.
Here is the code in question (simplified), and the resulting error:
> zz = textConnection('tempConnection', 'wb')
> saveRDS(c("a", "b", "c"), zz, ascii = TRUE)
> serialized_obj = paste(textConnectionValue(zz), collapse='\n')
> readRDS(textConnection(serialized_obj))
Error in gzcon(file) : 'read' not enabled for this connection
Docs haven't been much help in this case. I've tried a number of variations
but no luck. readRDS() was updated in v3.4.1, but I'm hesitant to call this
a bug without intimate knowledge of the source. Any help would be greatly
appreciated.
[[alternative HTML version deleted]]
More information about the R-help
mailing list