[R] Which data structure in R can mimic hash in PERL best?

Leon Yee yee.leon at gmail.com
Tue Nov 18 12:45:05 CET 2008


Hi,

Hans W. Borchers wrote:
>> Dear all,
>>
>>    Which data structure in R can mimic hash in PERL? I'd like to set
>> up a lookup table, which could be accomplished by HASH if using PERL.
>> Which of the data structures in R is the most efficient for lookup
>> table?
>> Thanks for your help.
> 
> The regular answer to this is "named arrays/vectors" or "environments" 
> and has been given several times here on R-help. Unfortunately, 
> everybody is applying a different terminology such as 'maps', 'hashes', 
> 'tables' or 'dictionaries', etc., so it's difficult to search for those 
> entries.
> 

   Thank you all for the help. Actually, I just used named vectors to 
solve my problem. I am not sure whether there is some difference in 
efficiency when comparing named vectors/arrays and environments.

Best wishes!
Leon



More information about the R-help mailing list