Skip to content
Back to formatted view

Raw Message

Message-ID: <73f827b50812232106n1621cf56m9f102b39d0213f0c@mail.gmail.com>
Date: 2008-12-24T05:06:35Z
From: Gundala Viswanath
Subject: Conditional Counting with Table

Dear all,

I have the following data frame:

V1     V2
aaa    chr1
aaa    chr2
aaa    NM
aaa    QC
aaa    chr10
att      NM
att      chr7

What I want to do is to count the string (V1).
But the condition of counting is: if the V2 of the string
is "NM" or "QC"  then the count is not increased.

Hence the contigency table will look like this:

#tag       count
aaa  3
att    1

Is there a compact way to achieve that in R?
I am thinking of using "table" but can't see
how to impose such condition into it.


- Gundala Viswanath
Jakarta - Indonesia