Hello,

I've contacted the guys from RKWard. Below I paste the answer Thomas
Friedrichsmeier gave me.

-------

Hi,

the problem appears to be our use of "active bindings" (see
?makeActiveBinding). Internally, RKWard replaces all objects inside
.GlobalEnv
by active bindings. This allows us to find out, when the objects get
modified.
For almost all purposes, these active bindings behave just like the regular
object, but apparently, as.list() copies the accessor functions, instead. I
do
wonder whether that is the expected behavior of as.list()...

Either way, RKWard will probably switch to a different strategy for
detecting
when objects get modified, in the not-too-distant future. The problem should
go
away, then. Meanwhile, perhaps you can work around the problem using code
like
this:

oblist <- sapply (ls (all.names=TRUE), function (x) get (x), simplify=FALSE)

Regards
Thomas

On Tue, Jan 4, 2011 at 2:54 PM, William Dunlap <wdun...@tibco.com> wrote:

> Under RKWard, do you get (at the command line)
>  > environment()
>  <environment: R_GlobalEnv>
> If environment() doesn't evaluate to .GlobalEnv's
> value then
>   as.list(environment())
> may show the B=1000.  It may be that RKWard doesn't
> use .GlobalEnv in the usual way.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
> > -----Original Message-----
> > From: r-help-boun...@r-project.org
> > [mailto:r-help-boun...@r-project.org] On Behalf Of Eduardo de
> > Oliveira Horta
> > Sent: Tuesday, January 04, 2011 6:25 AM
> > To: r-help@r-project.org
> > Subject: Re: [R] Saving objects inside a list
> >
> > Hello, (and a happy new year for you too!)
> >
> > Apparently the problem is happening only within my RKWard sessions:
> > > B = 1000
> > > oblist = as.list(.GlobalEnv)
> > > str(oblist)
> > List of 1
> >  $ B:function (value)
> > > oblist$B
> > function (value)
> > {
> >     if (!missing(value)) {
> >         assign(k, value, envir = .rk.watched.symbols)
> >         .rk.do.call("ws", k)
> >         invisible(value)
> >     }
> >     else {
> >         get(k, envir = .rk.watched.symbols)
> >     }
> > }
> > <environment: 0x08cc9eec>
> >
> > Now the same code in a regular Rgui session:
> > > B = 1000
> > > oblist = as.list(.GlobalEnv)
> > > str(oblist)
> > List of 1
> >  $ B: num 1000
> > > oblist$B
> > [1] 1000
> >
> > Problem solved?
> >
> > Best regards,
> >
> > Eduardo Horta
> >
> > On Tue, Jan 4, 2011 at 9:41 AM, Olivier ETERRADOSSI <
> > olivier.eterrado...@mines-ales.fr> wrote:
> >
> > > Message: 42
> > >> Date: Mon, 3 Jan 2011 18:58:04 -0200
> > >> From: Eduardo de Oliveira Horta<eduardo.oliveiraho...@gmail.com>
> > >>
> > >> To: r-help<r-help@r-project.org>
> > >> Subject: Re: [R] Saving objects inside a list
> > >> Message-ID:
> > >>
> > <aanlktimbxmr0rusiws1grorhjh=wstofzqdoc-90z...@mail.gmail.com>
> > >> Content-Type: text/plain
> > >>
> > >>
> > >> sapply(ls(),get) works fine. Thanks.
> > >>
> > >> ps: the as.list and the eapply suggestions didn't work.
> > >>
> > > Hi Eduardo (and all the best for this new year),
> > >
> > > are you sure the as.list and eapply solutions didn't work ?
> > On my machine
> > > they produce a list but in "reverse order" compared to the result of
> > > ls(),...maybe it's the same with you :
> > >
> > > names(as.list(.GlobalEnv))[6] is the name of the 6th
> > variable FROM THE END
> > > of ls().
> > >
> > > Regards. Olivier
> > >
> > > --
> > > Olivier ETERRADOSSI
> > > Maître-Assistant
> > > animateur du groupe Sensomines (Institut Carnot M.I.N.E.S)
> > > -------------------------------------------------------------
> > > CMGD
> > > Pôle "Matériaux Polymères Avancés"
> > > axe "Propriétés Psycho-Sensorielles des Matériaux"
> > > -------------------------------------------------------------
> > > Ecole des Mines d'Alès
> > > Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
> > > tel std: +33 (0)5.59.30.54.25
> > > tel direct: +33 (0)5.59.30.90.35
> > > fax: +33 (0)5.59.30.63.68
> > > http://www.mines-ales.fr
> > > e-mail : olivier.eterrado...@mines-ales.fr
> > >
> > >
> > >
> >
> >       [[alternative HTML version deleted]]
> >
> >
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to