Reduce the (serialized) memory footprint of an object.

strip(object, ...)

# S4 method for lcMethod
strip(object, ..., classes = "formula")

# S4 method for ANY
strip(object, ..., classes = "formula")

# S4 method for lcModel
strip(object, ..., classes = "formula")

Arguments

object

The model.

...

Not used.

classes

The object classes for which to remove their assigned environment. By default, only environments from formula are removed.

Value

The stripped (i.e., updated) object.

Details

Serializing references to environments results in the serialization of the object together with any associated environments and references. This method removes those environments and references, greatly reducing the serialized object size.

Implementation

Classes extending lcModel can override this method to remove additional non-essentials.


setMethod("strip", "lcModelExt", function(object, ..., classes = "formula") {
  object <- callNextMethod()
  # further process the object
  return(object)
})

Examples

data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData)
newModel <- strip(model)