[R] how to get R interpreter to remember constant values without using any memory location

Don MacQueen macq at llnl.gov
Thu Aug 13 21:17:20 CEST 2009


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, <mauede at 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 at 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




More information about the R-help mailing list