Skip to content
Prev 59322 / 398502 Next

hashing using named lists

ulas karaoz wrote:

            
yes...
because we're lazy? :)
you can explicitly test the names for equality, eg with this 2-element 
list:

  > x
  $name
  [1] 1 2 3

  $n
  [1] 3 2 1

  You can do:

  > x[names(x)=='name']
  $name
  [1] 1 2 3

  > x[names(x)=='na']
  list()

  > x[names(x)=='n']
  $n
  [1] 3 2 1

  Of course, the right way would be to create a new class, 'hash' 
perhaps, that did all this in its '$' or '[' methods.

Baz