Re: [R] Counting

From: Jim Silverton <jim.silverton_at_gmail.com>
Date: Thu, 17 Mar 2011 14:54:49 -0400


I have a matrix say:

23 1
12 12
0 0
0 1
0 1
0 2
23 2

I want to count of number of distinct rows and the number of disinct element in the second column and put these counts in a column. SO at the end of the day I should have:

c(1, 1, 1, 2, 2, 1, 1) for the distinct rows and c(1, 1, 1, 2, 2, 2, 2) for the counts of how many times the elements in the second column exists. Any help is greatly appreciated.

-- 
Thanks,
Jim.

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_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.
Received on Thu 17 Mar 2011 - 18:57:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Mar 2011 - 20:10:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive