r - Get row numbers of unique rows in a matrix -


i have matrix has unique rows , row names of unique rows only.

m <- matrix( data = c(1,1,2,1,1,2,1,1,2), ncol = 3 ) 

if expected row index '3' other 2 rows duplicates, use duplicated logical index , wrap which numeric index.

 which(!(duplicated(m)|duplicated(m,fromlast=true)))  #[1] 3 

if consider 1st , 3rd unique rows,

 which(!duplicated(m)) 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -