[R] Function to do multiple named lookups faster?

2007-02-27 Thread David Reiss
Hi, I apologize if this topic has been discussed - I could not figure out a good search phrase for this question. I have a named vector x, with multiple (duplicate) names, and I would like to obtain a (shorter) vector with non-duplicate names in which the values are the means of the values of the

Re: [R] Function to do multiple named lookups faster?

2007-02-27 Thread jim holtman
try this: x - 1:30 names(x) - sample(LETTERS[1:5], 30, TRUE) x B B C E B E E D D A B A D B D C D E B D E B D A B B A B E B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 x - 1:30 names(x) - sample(LETTERS[1:5], 30,