# save a .RData object
obj <- list(X=1:10, Y=seq(1, 10, 0.1))
save(obj, file="tmp.RData")
# cteate a GDS file
f <- createfn.gds("test.gds")
add.gdsn(f, "double", val=seq(1, 1000, 0.4))
addfile.gdsn(f, "tmp.RData", "tmp.RData")
# open the GDS file
closefn.gds(f)
# open the existing file
(f <- openfn.gds("test.gds"))
getfile.gdsn(index.gdsn(f, "tmp.RData"), "tmp1.RData")
(obj <- get(load("tmp1.RData")))
# open the GDS file
closefn.gds(f)
# delete the temporary files
unlink(c("test.gds", "tmp.RData", "tmp1.RData"), force=TRUE)
Run the code above in your browser using DataLab