[R] Problem with serialization via readRDS() on a textConnection()
Duncan Murdoch
murdoch.duncan at gmail.com
Wed Aug 9 15:01:07 CEST 2017
(Sorry for not linking to your message; I accidentally deleted the
original copy of your message.)
Your code
> 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
has one problem: textConnectionValue(zz) may not be the complete text
because zz hasn't been closed. You should close(zz), then get the
result from the variable tempConnection.
However, this doesn't fix the problem you saw, which appears to be a bug
in readRDS or gzcon. I'll post it to the bug list.
Duncan Murdoch
More information about the R-help
mailing list