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

2008-11-18 Thread Leon Yee
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

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

2008-11-18 Thread Wacek Kusnierczyk
Leon Yee wrote: 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.

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

2008-11-15 Thread Leon Yee
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. Best regards, Leon

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

2008-11-15 Thread Duncan Temple Lang
You could use new.env(hash = TRUE, emptyenv()) and you can even specify an initial size. Seth Falcon has a package named dict that allows for different choices of hash function. D. Leon Yee wrote: Dear all, Which data structure in R can mimic hash in PERL? I'd like to set up a

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

2008-11-15 Thread Hans W. Borchers
} invisible(val) } clear.h - function(dict) { rm(list=keys.h(dict), envir=dict) } #--- -- View this message in context: http://www.nabble.com/Which-data-structure-in-R-can-mimic-hash-in-PERL-best--tp20515707p20517058.html Sent from

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

2008-11-15 Thread Duncan Temple Lang
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. Best regards, Leon

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

2008-11-15 Thread Wacek Kusnierczyk
Duncan Temple Lang wrote: Hans W. Borchers wrote: Below I enclose a solution that I have written some month ago. It is given in pythonic language, but you can easily translate it into the corresponding Perl terms. One drawback is that one cannot use numbers as keys, only keys following the