简体   繁体   中英

Why object becomes different after save/load to/from RData?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM