save.image Doesn't Save Objects When Browsing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

save.image Doesn't Save Objects When Browsing

Dario Strbenac-2
The documentation states that "save.image() is just a short-cut for save(list = ls(all = TRUE), file = ".RData")". However, if I do

Browse[1]> ls(all=TRUE)
[1] "expression"         "orderedFeatures"    "predictParams"    
[4] "resubstituteParams" "trainParams"        "verbose"
Browse[1]> save.image("BROWSE.RData")

load("BROWSE.RData") shows different variables than ls() did. Explicitly typing

Browse[1]> save(list = ls(all = TRUE), file = ".RData")

causes the variables in the current environment to be saved.

Is the documentation of save.image() missing a special case ?

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: save.image Doesn't Save Objects When Browsing

Prof Brian Ripley
On 20/02/2015 01:00, Dario Strbenac wrote:

> The documentation states that "save.image() is just a short-cut for save(list = ls(all = TRUE), file = ".RData")". However, if I do
>
> Browse[1]> ls(all=TRUE)
> [1] "expression"         "orderedFeatures"    "predictParams"
> [4] "resubstituteParams" "trainParams"        "verbose"
> Browse[1]> save.image("BROWSE.RData")
>
> load("BROWSE.RData") shows different variables than ls() did. Explicitly typing
>
> Browse[1]> save(list = ls(all = TRUE), file = ".RData")
>
> causes the variables in the current environment to be saved.
>
> Is the documentation of save.image() missing a special case?

You are missing the other arguments.  What it actually says is

     ‘save.image()’ is just a short-cut for ‘save my current
      workspace’,

and for that you need to specify envir=.GlobalEnv .

>
> --------------------------------------
> Dario Strbenac
> PhD Student
> University of Sydney
> Camperdown NSW 2050
> Australia
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


--
Brian D. Ripley,                  [hidden email]
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel