[R] hashing using named lists

Roger D. Peng rpeng at jhsph.edu
Thu Nov 18 18:47:42 CET 2004


You could try using environments:

 > e <- new.env(hash = TRUE)
 > e$new <- 1:4
 > ls(e)
[1] "new"
 > e$new
[1] 1 2 3 4
 > e$ne
NULL

-roger

ulas karaoz wrote:
> hi all,
> I am trying to use named list to hash a bunch of vector by name, for 
> instance:
> test = list()
> test$name = c(1,2,3)
> 
> the problem is that when i try to get the values back by using the name, 
> the matching isn't done in an exact way, so
> test$na is not NULL.
> 
> is there a way around this?
> Why by default all.equal.list doesnt require an exact match?
> How can I do hashing in R?
> 
> thanks.
> ulas.
> 
> ______________________________________________
> R-help at 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
> 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/




More information about the R-help mailing list