A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/eddelbuettel/rprotobuf/issues/28 below:

RProtoBuf cannot deserialize certain invalid R objects · Issue #28 · eddelbuettel/rprotobuf · GitHub

R version 3.3.2 (2016-10-31)
RProtoBuf_0.4.9

When using this library to serialize and deserialize certain lm objects:

x <- factor(c("a","b","c","a","c"))
y <- 1:5
z<-lm(x ~ y)
serialized <- RProtoBuf::serialize_pb(object=z, connection=NULL)
RProtoBuf::unserialize_pb(serialized)

I get the following error:

Error in attributes(xobj) <- attrib : adding class "factor" to an invalid object

This is because lm is creating an invalid r object (a factor class with non integer values):

z$residuals
Error in as.character.factor(x) : malformed factor`

Although these calls to lm are invalid, It would be nice for the library to be able to support this since both read and readRDS both do. It would make sense for the library to be able to recreate the state of the object regardless of validity

I'm presuming this will most likely require part of the deserialization code to be written in C?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4