hashing using named lists
On Thu, 18 Nov 2004, 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?
?match on the names
Why by default all.equal.list doesnt require an exact match?
What do you mean by that? It (by default or not) tests all the attributes, including the names: test <- list(name=1:3) test2 <- list(na=1:3) all.equal(test, test2) [1] "Names: 1 string mismatches" Now, all.equal does not require an exact match, deliberately: that is what identical() is for: identical(test, test2) [1] FALSE
How can I do hashing in R?
?match
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595