R Under development (unstable) (2024-09-25 r87194 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library(RApiSerialize) > > data(trees) > fit <- lm(log(Girth) ~ log(Volume) + log(Height), trees) > > ## serialize and use R's unserialize > identical(unserialize(serializeToRaw(fit)), fit) [1] TRUE > identical(unserialize(serializeToRaw(fit,2)), fit) [1] TRUE > identical(unserialize(serializeToRaw(fit,3)), fit) [1] TRUE > ## serialize and use our unserialize > identical(unserializeFromRaw(serializeToRaw(fit)), fit) [1] TRUE > identical(unserializeFromRaw(serializeToRaw(fit,2)), fit) [1] TRUE > identical(unserializeFromRaw(serializeToRaw(fit,3)), fit) [1] TRUE > ## R's serialize and our unserialize > identical(unserializeFromRaw(serialize(fit, NULL)), fit) [1] TRUE > ## R's serialize and R's unserialize (doh) > identical(unserialize(serialize(fit, NULL)), fit) [1] TRUE > ## serialize and use our unserialize, no xdr > identical(unserializeFromRaw(serializeToRaw(fit,2,TRUE)), fit) [1] TRUE > identical(unserializeFromRaw(serializeToRaw(fit,3,TRUE)), fit) [1] TRUE > identical(unserializeFromRaw(serializeToRaw(fit,2,FALSE)), fit) [1] TRUE > identical(unserializeFromRaw(serializeToRaw(fit,3,FALSE)), fit) [1] TRUE > > proc.time() user system elapsed 0.15 0.01 0.17