[R] save/load and package namespaces

David Winsemius dwinsemius at comcast.net
Wed Nov 7 21:53:26 CET 2012


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




More information about the R-help mailing list