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

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -