(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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to