Is there some good R package that can convert prediction models and other complex object to and from JSON? I have linear regression model from this example:
eruption.lm = lm(eruptions ~ waiting, data=faithful)
newdata = data.frame(waiting=80)
predict(eruption.lm, newdata)
I would like to serialize eruption.lm model as JSON store it somewhere or send it to some external system, and later deserialize it and do prediction. I have tried with jsonlite R package:
json<-serializeJSON(eruption.lm)
lin.model<-unserializeJSON(json)
predict(lin.model, newdata)
However, jsonlite cannot handle complex objects - deserialized model returns an error in prediction:
Error in eval(expr, envir, enclos) : could not find function "list"
Is there some better package that can serialize/deserialize objects.