s-news
[Top] [All Lists]

Re: simple function

To: "'Leeds, Mark'" <mleeds@mlp.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: simple function
From: "Christos Hatzis" <christos@nuverabio.com>
Date: Sun, 12 Jun 2005 00:05:09 -0400
Cc: <cspark@ces.clemson.edu>
In-reply-to: <54668D97C0199943A454516A5FF6481E58AEE1@EXCHUS001.AD.MLP.COM>
Organization: Nuvera Biosciences
Reply-to: <christos@nuverabio.com>
Thread-index: AcVvAY9f8+Cl6QAPR6yuO/Tmgsd7fwAAh4Qg
Try
 
> x <- c(a=3, b=4, c=5, a=3, c=5)
> x
 a b c a c
 3 4 5 3 5
 
> x[!duplicated(x)]
 a b c
 3 4 5

-Christos

From: s-news-owner@lists.biostat.wustl.edu [mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Leeds, Mark
Sent: Saturday, June 11, 2005 11:48 PM
To: s-news@lists.biostat.wustl.edu
Cc: cspark@ces.clemson.edu
Subject: [S] simple function

I have a vector that

Has names

 

So it might be

 

AAA   BBB     AAA  CCC        BBB

 3         4          3        2            4

 

so I want a function that  returns as

below ( just the unique names ).

 

AAA      BBB     CCCC

 

 3            4            2

 

also, if it has the same name it will

always have the same #  so

the case of same name with different

number doesn’t have to be dealt with.

 

 

                                    thanks

<Prev in Thread] Current Thread [Next in Thread>