Why object becomes different after save/load to/from RData?
load, object, r, rdata, save
Solution
Environments are one of a few R object types (connections are another) for which saving and loading aren't exact inverses.
e <- new.env()
f <- e
identical(e,f)
# [1] TRUE
save("f", file="f.Rdata")
rm(f)
load("f.Rdata")
identical(e,f)
# [1] FALSE
`ExpressionSet` objects contain an `assayData` slot, of class `AssayData`, which is described as a "container class defined as a class union of `list` and `environment`". Though I don't have eset installed on my computer, I'd guess that the `assayData` slots of `eset` and `e2` make reference to different environments, causing `identical(eset, e2)` to return `FALSE`.
Problem
I have a large ExpressionSet object (Bioconductor) named `eset`. Can you explain why this happens? Why the object's copy is not identical to the original one after save/load? ``` > e2=eset > identical(e2,eset) [1] TRUE > save(e2,file="test.RData") > rm(e2) > e2 # just to check the removal Error: object 'e2' not found > load("test.RData") > identical(e2,eset) [1] FALSE ``` Are there other ways to check the identity of two objects? If needed I'm working with R 2.15.1 under Windows 7.