Skip to content
Back to formatted view

Raw Message

Message-ID: <419CE2BD.5000504@lancaster.ac.uk>
Date: 2004-11-18T17:58:21Z
From: Barry Rowlingson
Subject: hashing using named lists
In-Reply-To: <06E6EB1E-397F-11D9-AD4A-000A95764B04@bu.edu>

ulas karaoz wrote:

> is there a way around this?

  yes...

> Why by default all.equal.list doesnt require an exact match?

  because we're lazy? :)

> How can I do hashing in R?

  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