Read the help page for load....particularly the part about environments.
E.g.,
a <- 3
save("a", file = "temp.RData")
a <- 4
env <- new.env()
load("temp.RData", env)
identical(a, 4)
identical(env$a, 3)
Michael
On Sat, Jan 21, 2012 at 9:54 PM, Michael <comtech.usa at gmail.com>
wrote:> Hi all,
>
> I have already some important variables in the current R session;
>
> and I wanted to load some rData file which was saved during the last R
> session using "save.image"...
>
> But how do I avoid the newly loaded data/variables messing with my existing
> data/variables?
>
> In Matlab, I can do:
>
> mynewdata=load("imagefromlastRsession.rData")
>
> and then I can access the variables therein as follows:
>
> mynewdata.variable1
> ?mynewdata.variable2
> ?mynewdata.variable3
> ...
> ...
> ...
>
> As you can see, this way, these variables won't interfere with my
existing
> variables in the current R session...
>
> How to do that?
>
> Thanks a lot!
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.