[R] how to view and edit this RData file

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Jul 22 12:40:28 CEST 2020


>>>>> Ivan Krylov n Wed, 22 Jul 2020 12:42:48 +0300 writes:

   > On Tue, 21 Jul 2020 21:35:49 -1000 Jason Levy <lev7379 using gmail.com> wrote:

    >> I would like help on how to view, edit and save this
    >> 2.461 MB RData file.

    > Check out the envir= argument to load() and save() if you
    > want to isolate the loaded data from the rest of the
    > session.

    > For an example:

    > # create an environment to load the .rda into...
    > dataenv <- new.env(parent = emptyenv())
    > load('data.rda', envir = dataenv) # ...and load it there
    > ls(dataenv) # see what was inside the .rda file

    > dataenv$z <- volcano # edit the contents of the environment
    > # save the contents of the environment to an .rda file
    > save(list = ls(dataenv), file = 'data.rda', envir = dataenv)

    > -- 
    > Best regards,
    > Ivan

Indeed.
An -- underused and not much known -- alternative is to use

  attach("data.rda")

in my view *the only*  "legitimate" use of attach() nowadays.

Martin Maechler
ETH Zurich  and   R Core team



More information about the R-help mailing list