s-news
[Top] [All Lists]

factor column in a data frame

To: <s-news@lists.biostat.wustl.edu>
Subject: factor column in a data frame
From: "Khan, Sohail" <khan@cshl.edu>
Date: Mon, 20 Mar 2006 11:59:01 -0500
Thread-index: AcZMP5ZQ999FX3X0Rsa92MzEdAVptA==
Thread-topic: factor column in a data frame
Dear List,

I have a data frame as follows:

ID         Ratio
a       2.5
a       3.5
a       1.3
b       2.9
b       3.9
c       5.2
c       3.6

I would like to count the factors in the ID column and label them as such, so 
they look like:
ID         Ratio
a-1     2.5
a-2     3.5
a-3     1.3
b-1     2.9
b-2     3.9
c-1     5.2
c-2     3.6

Thanks for any suggestions/advice.


Sohail Khan
Scientific Programmer
COLD SPRING HARBOR LABORATORY
Genome Research Center
500 Sunnyside Boulevard
Woodbury, NY 11797
(516)422-4076


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