Hi > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of asafwe > Sent: Monday, October 22, 2012 4:02 AM > To: r-help@r-project.org > Subject: [R] Counting duplicates in a dataframe > > 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.
How is it realated with duplicates? Do you want something like that? xtabs(~Gender+Dosage, data=some.data.frame) Regards Petr > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.