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.
To save data as an RData object, use the save function. To save data as a RDS object, use the saveRDS function. In each case, the first argument should be the name of the R object you wish to save. You should then include a file argument that has the file name or file path you want to save the data set to.
You can also save the entire R console screen within the GUI by clicking on "Save to File..." under the menu "File." This saves the commands and the output to a text file, exactly as you see them on the screen.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With