Differences between hash and lists in R
hash, list, r
Solution
from the `hash` documentation:
PASS-BY REFERENCE. Environments and hashes are special objects in R because only one copy exists globally. When provide as an argument to a function, no local copy is made and any changes to the hash in the functions are reflected globally.
PERFORMANCE. Hashes are based on environments and are designed to be exceedingly fast using the environments internal hash table. For small data structures, a list will out-perform a hash in nearly every case. For larger data structure, i.e. >100-1000 key value pair the performance of the hash becomes faster. Much beyond that the performance of the hash far outperforms native lists.
Problem
In R, I find lists to be useful structures (like dictionaries in Python). I stumbled upon the `hash` package which seems to provide very similar functionality. Are there any practical differences between lists and hashes that make one more desirable than the other? (Other than lists are part of the base) I hope this isn't too open ended, but not sure how to narrow the scope of this.