[R] counting specific elements in a column of a matrix

From: Donna Tucker <ladylilly_at_hotmail.com>
Date: Sat, 08 Mar 2008 14:15:09 -0600

I would like to know how to count the number (cardinality) of a specific element in a single row of a matrix. At this time I have 30X3 matrix. The first column is the treatment number for each data point. I would like to know how many of each treatments are in this matrix. i.e. I want to know how many 1's are in column 1, how many 2's are in column 1, etc. I found a couple references to the length function, but I could not make any of them work. Thanks,

[[elided Hotmail spam]]

        [[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 Sat 08 Mar 2008 - 20:19:05 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 Sat 08 Mar 2008 - 21:30:21 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