Re: [R] number of count of each unique row

2007-12-23 Thread Benilton Carvalho
i didn't test, but i think you want something like: table(apply(x, 1, paste, collapse=",")) where "x" is your matrix... b On Dec 23, 2007, at 5:01 AM, Jim Lemon wrote: Louis Martin wrote: Hi, I have a matrix of duplicate rows. How to output a list the unique rows with their count? I have

Re: [R] number of count of each unique row

2007-12-23 Thread Jim Lemon
Louis Martin wrote: > Hi, > > I have a matrix of duplicate rows. How to output a list the unique rows with > their count? I have used "unique" to have the unique rows, but can't produce > the occurences of each unique row. > Hi Louis, If you want the unique rows returned, this might do the job.

Re: [R] number of count of each unique row

2007-12-22 Thread G. Jay Kerns
Hi Louis, If I am understanding your question correctly, here is one way: suppose your matrix is M of dimension n x k. D <- data.frame(M) # convert to data frame ones <- rep(1, n) # a column of 1s Now you can count the number of repeats of each unique row. aggregate( ones, by = as.list(D), F

[R] number of count of each unique row

2007-12-22 Thread Louis Martin
Hi, I have a matrix of duplicate rows. How to output a list the unique rows with their count? I have used "unique" to have the unique rows, but can't produce the occurences of each unique row. Thanks Louis - [[alternative HTML version de