Skip to content
Prev 59325 / 398502 Next

hashing using named lists

Use match() for exact matching,

i.e.,

 > test[[match("name", names(test))]]

Yes, it is more cumbersome.  This partial matching is considered by some to 
be a design fault, but changing it would break too many programs that 
depend upon it.

I don't understand your question about all.equal.list() -- it does seem to 
require exact matches on names, e.g.:

 > all.equal(list(a=1:3), list(aa=1:3))
[1] "Names: 1 string mismatches"
 > all.equal(list(aa=1:3), list(a=1:3))
[1] "Names: 1 string mismatches"
 >

(the above run in R 2.0.0)

-- Tony Plate

(BTW, in R this operation is generally called "indexing" or "subscripting" 
or "extraction", but not "hashing".  "Hashing" is a specific technique for 
managing and looking up indices, which is why some other programming 
languages refer to list-like objects that are indexed by character strings 
as "hashes".  I don't think hashing is used for list names in R, but 
someone please correct me if I'm wrong! )
At Thursday 09:29 AM 11/18/2004, ulas karaoz wrote: