[R] save/load and package namespaces

David Winsemius
Wed, 07 Nov 2012 20:53:26 -0000

On Nov 7, 2012, at 9:50 AM, Jamie Olson wrote:

> Could someone explain to me what namespaces are loaded/saved when objects
> are saved?

None. That's what require() or library() or source() are for.

>
> Specifically, I'm using this:
> save(list = ls(all.names = TRUE, envir = envir), file = name, envir >
envir)
> to save out everything from an environment.

You need to read more carefully:

?ls
?objects
?search

>
> Later, loading it on another machine, I'm surprised to see the load
failing
> for being unable to load certain packages.  Could anyone help me understand
> why this happens?

`ls` with default settings only lists data and function objects that the user
has defined. The history mechanism could be used to restore packages that were
loaded during a session.

?history

You should be able to see this by looking at what ls() produces. It does not
generally return a listing of items in loaded packages.

--

David Winsemius, MD
Alameda, CA, USA