[R] Counting duplicates in a dataframe

asafwe asafw at wharton.upenn.edu
Mon Oct 22 04:02:09 CEST 2012


Hello,

I am looking at a two-way ANOVA dataset, and would like to count the rows in
the dataframe with the same level of the first factor ("Gender") and the
second factor ("Dosage"). In other words, I am interested in the number of
observations per each "cell" in a (not necessarily balanced) two-way layout.

What is the simplest way to do this?

Thanks a lot,

Asaf

   Observation Gender Dosage Alertness
1            1      m      a         8
2            2      m      a        12
3            3      m      a        13
4            4      m      a        12
5            5      m      b         6
6            6      m      b         7
7            7      m      b        23
8            8      m      b        14
9            9      f      a        15
10          10      f      a        12
11          11      f      a        22
12          12      f      a        14
13          13      f      b        15
14          14      f      b        12
15          15      f      b        18
16          16      f      b        22



--
View this message in context: http://r.789695.n4.nabble.com/Counting-duplicates-in-a-dataframe-tp4646954.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list