Re: [R] Remove rows that have repeated items in a particular column

2012-07-26 Thread arun
To: r-help@r-project.org Cc: Sent: Thursday, July 26, 2012 12:50 AM Subject: [R] Remove rows that have repeated items in a particular column Dear R Users, I apology for not being able to provide an adequately informative subject. Let me describe my problem with an example. For a matrix

Re: [R] Remove rows that have repeated items in a particular column

2012-07-26 Thread arun
HI, Try this:  mat[!duplicated(mat[,1]),] [,1] [,2] [1,]    1    5 [2,]    2    1 [3,]    3    4 A.K. - Original Message - From: Zhongyi Yuan zhongyi-y...@uiowa.edu To: r-help@r-project.org Cc: Sent: Thursday, July 26, 2012 12:50 AM Subject: [R] Remove rows that have repeated

[R] Remove rows that have repeated items in a particular column

2012-07-25 Thread Zhongyi Yuan
Dear R Users, I apology for not being able to provide an adequately informative subject. Let me describe my problem with an example. For a matrix *(mat - matrix(c(1,1,2,2,2,3,3, 5,9,1,3,7,4,8), ncol = 2))* my desired output is *(desired - matrix(c(1,2,3, 5,1,4), ncol = 2))* That is, the

Re: [R] Remove rows that have repeated items in a particular column

2012-07-25 Thread MK
Very simple mat[!duplicated(mat[, 1]), ] M On 26/07/12 06:50, Zhongyi Yuan wrote: Dear R Users, I apology for not being able to provide an adequately informative subject. Let me describe my problem with an example. For a matrix *(mat - matrix(c(1,1,2,2,2,3,3, 5,9,1,3,7,4,8), ncol = 2))*

Re: [R] Remove rows that have repeated items in a particular column

2012-07-25 Thread Zhongyi Yuan
Worked like a charm. Thanks. Zhongyi On Wed, Jul 25, 2012 at 11:58 PM, MK mkao006rm...@gmail.com wrote: Very simple mat[!duplicated(mat[, 1]), ] M [[alternative HTML version deleted]] __ R-help@r-project.org mailing list