Thank you for all your suggestiona. I tried to write a self-contained example which turned oiut to confuse people's miind. I realized also the formulation of my question was unclear. Sorry for that.
What I had in mind was something similar to Fortran Parameter declaration. I spent some time dealing with Monte Carlo codes for radiation trasport. In this particular research filed it's pretty common to come across Fortran code, like it or not. For example, through Fortran Parameter declaration, I can assign a name to a big floating-point number, something like Parameter( A = 123E-15) without having the compiler to allocate 32 (REAL data type) or 64 (DOUBLE data type) consecutive memory locations to accommodate such a number. Of course the computer must save any constant data somewhere but neglecting its data type, therefore saving memory space. In my R script I have to deal with a dynamically varying list of references. Something simiilar to what LaTeX interpreter does when we use it to write a manuscript. That is, we do not have to renumber the bibliography references list whenever we insert a new citation into, or remove an existing one from our manuscript. LaTeX takes care of that. We just cite references through labels taht LaTeX translates into a dynamically ordered list of numbers. So, factors may work fine for me. Another possibility that downed on me may be to name the list elements, although I will have to update the list names every time the list is updaed. Thank you again, Maura -----Messaggio originale----- Da: Don MacQueen [mailto:m...@llnl.gov] Inviato: gio 13/08/2009 21.17 A: mau...@alice.it; r-h...@stat.math.ethz.ch Oggetto: Re: [R] how to get R interpreter to remember constant values without using any memory location Like Ben, I wonder what the reason for doing this is. First of all, the amount of memory indicated by your example is so small I can't imagine it would make any difference. If you have such a large number of values that the amount of memory is significant -- and store them somewhere that isn't in memory (such as physical disk memory), then reading them into memory when you need to use them might affect performance a lot. Environment variables use memory also -- it's just someone else's memory (the OS instead of R). -Don At 4:05 PM +0200 8/13/09, <mau...@alice.it> wrote: >Maybe I expect too much from a non compiled language. >Anyway, I wonder whether it is possible in R to set constant values >without using any memory location that would take useless space >bacause such values are not going to be changed along the program. >It's just a way to assign a mnemnic name tos some constant values. >For instance, I would like R interpreter to replace all occurrences >of mnemonic "Monday" with the number 1, "Tuesday" with the number >2, "Wednesday with the number 3, and so on ... without having to >assign such values to memory locations. >Maybe environment variables are the way to go ? > >Thank you in advance for your advice, >Maura > > > > >tutti i telefonini TIM! > > > [[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. -- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 -------------------------------------- tutti i telefonini TIM! [[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.