[R] Unique lists from a list

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Wed Sep 1 16:31:52 CEST 2004


Hi

I have a list.  Two of the elements of this list are "Name" and
"Address", both of which are character vectors.  Name and Address are
linked, so that the same "Name" always associates with the same
"Address".

What I want to do is pull out the unique values, as a new list of the
same format (ie two elements of character vectors).  Now I've worked out
that unique(list$Name) will give me a list of the unique names, but how
do I then go and link those to the correct (unique) addresses so I end
up with a new list which is the same format as the rest, but now unique?

Cheers
Mick




More information about the R-help mailing list