Re: [R] Dynamic Dictionary Data Type?

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Fri 03 Jun 2005 - 00:44:21 EST

On Thu, 2 Jun 2005, hadley wickham wrote:

>> cache results. Other languages usually offer a dictionary data type
>> which I can use as an efficient way to dynamically cache already
>> calculated results - what's the best way to do this in R?
>
> It really depends on what sort of data you want to cache - if it is
> fundamentally 1D, use a vector, 2D use a matrix etc. The closest
> equivalent to dictionary/hashmap is a list - however R's pass a copy
> semantics might slow things down if you are caching a lot of data.
>

An environment is a hash table, and copying occurs only on modification, when any language would have to copy in this context.

         -thomas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 03 00:54:28 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:21 EST