Re: [R] Count unique rows/columns in a matrix

2008-01-12 Thread Gabor Csardi
Chuck, thanks a lot, this is a very good starting point. G. On Sat, Jan 12, 2008 at 01:08:11PM -0800, Charles C. Berry wrote: [...] > Gabor, > > Try this. Order the matrix rows, conpare adjacent rows, and run length > encode the logical vector of comparisons. Decode the rle() result to get > t

Re: [R] Count unique rows/columns in a matrix

2008-01-12 Thread Charles C. Berry
On Sat, 12 Jan 2008, Gabor Csardi wrote: > On Sat, Jan 12, 2008 at 12:35:47PM -0500, John Kane wrote: >> I definately did not read it that way but that may >> have been my fault. That table approach is quite >> nice! >> >> Using it, you could just rebuild the vectors from the >> names. Does this

Re: [R] Count unique rows/columns in a matrix

2008-01-12 Thread Gabor Csardi
On Sat, Jan 12, 2008 at 12:35:47PM -0500, John Kane wrote: > I definately did not read it that way but that may > have been my fault. That table approach is quite > nice! > > Using it, you could just rebuild the vectors from the > names. Does this do more or less what you want? John, thanks. Sti

Re: [R] Count unique rows/columns in a matrix

2008-01-11 Thread Gabor Csardi
Hmmm, maybe i wasn't clear enough. So, i need the number of occurences for each row/column in the matrix. For your matrix the desired output would be something like a matrix 1 2 3 4 5 6 1 3 2 1 1 1 and the number of occurences for each row: 2 2 1 1 I know some solutions like https://stat.eth

[R] Count unique rows/columns in a matrix

2008-01-11 Thread Gabor Csardi
Dear List, i know there are some solutions for this in the archive, but they're not very good for numeric matrices, since they usually convert rows/columns to character strings. Is there an easy way to do $subject for numeric matrices properly, or i need to do it by hand? Thanks, Gabor ___