[R] selectively load some objects from old workspace

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 18 22:07:57 CEST 2006


Either 1. in your old workspace create a separate file using save that
contains only the variables you want to transfer (see ?save) and then
load that or
2. load the whole thing into an environment

e <- new.env()
load("myspace.rda", e)

and then copy out all the variables you want and delete e (thereby
deleting its contents).

x <- e$x
rm(e)


On 10/18/06, Weiwei Shi <helprhelp at gmail.com> wrote:
> Dear Listers:
>
> I have a question on loading objects from workspace:
>
> suppose I have two workspaces for two approaches. My old workspace has
> some objects I need for the new workspace but I don't want to load the
> whole old workspace and remove most of the old objects and get what I
> want. Is there an easier way to do like this:
>
> load "some needed obj" from old workspace, which has been implemented in R?
>
> thanks
>
> --
> Weiwei Shi, Ph.D
> Research Scientist
> GeneGO, Inc.
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list