[R] Assignment of structures on a given environment

Rita Ribeiro rita at liacc.up.pt
Wed Oct 17 15:41:10 CEST 2001


Hi,


Robert Gentleman wrote:

> Yes there is a way without evalq.
> Simply get and retrieve the list. From your description you say that
> you need to
>   1) keep the list structure
>   2) keep successively updating the list structure
>
> >From those perspectives putting the list in an environment will not
> help you save copies. In R we generally copy on mutate (not always and
> it could be improved but mostly).
>
> You really have not described the problem that you are trying to
> solve, rather you are giving us an abstraction and from that it is
>

The list I'm building keeps a variety of information about some dataset!
Among other things the list keeps the dataset itself in the data frame R format.

As there are some huge datasets, I was wishing to avoid frequent copies of that
structure.

I've already pass that list as an argument and there seems to be no problem in
the execution. The only issue is that in very large datasets those frequent
copies could slow down the execution.

I've also stored this list in the Global environment, but as the program
produces also an output file with similar information I wouldn't like the idea
of leaving some "garbage" in the Global environment or making users manage some
global variable...... Ok, I can do 'rm', but if users do want to have access to
the produced list??
My idea was making the program  return some kind of pointer to the environment
where is the list at, which users would use if they want to access it.... I
thought that way it wouldn't be necessary any copies....

Well, I'm seeing that there is no much way around it....


    Thanks  again for the tips,

    Rita



> very hard for anyone to give you sensible advice.
>
> I still truely doubt that size is an issue. Have you tried passing the
> list directly? Do you know that size is an issue or do you just
> presume it?
>
> Finally a very ugly solution that involves no evalq's
>
> You can always store your list in the Global environment and access it
> using get, assign and <<-. There should be only one copy but if you
> keep changing it, it will be duplicated, that's kind of necessary.
>
> --
> +---------------------------------------------------------------------------+
> | Robert Gentleman                 phone : (617) 632-5250                   |
> | Associate Professor              fax:   (617)  632-2444                   |
> | Department of Biostatistics      office: M1B28
> | Harvard School of Public Health  email: rgentlem at jimmy.dfci.harvard.edu   |
> +---------------------------------------------------------------------------+

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list