Skip to content
Prev 256827 / 398506 Next

Hash table...

On 11-04-14 4:48 AM, Philipp Pagel wrote:
I haven't actually done timing, but if there are likely to be a lot of y 
values, I'd expect an environment created with hash=TRUE to be faster, 
both in adding new items and in retrieving existing ones.  The code is 
pretty similar:

Use

cache <- new.env(hash=TRUE)

to create it, and

ls(cache)

to list the names, or

as.list(cache)

to print it as a list.  Other than that, the assignment and retrieval 
code is identical.

Duncan Murdoch