Hi all,

I have a matrix with 10000 rows and 10 columns. The last columns contains 
another identifiers but the values are not uniques so that I want to generate 
another matrix with rows with unique values in the last column.

If I did

tmp<-unique(my_mat$col10) 

this will give me 8560 unique entries so the ideal matrix will be 8560X10 
columns now then. 

I tried

sub_mat<-my_mat[tmp,]

but it generated weird results with many "NA" values and the order was not 
changed. The original matrix was ranked from top so I don't want to lose the 
order too.

For the similar problem, I have used "match" function and do some manipulate to 
identify the index of the first appearance of each value but is there any 
better and neat way to achieve the same function?

Thanks,

Seungyeul Yoo

Postdoc Fellow,
Institute of Genomics and Multiscale Biology
Department of Genetics and Genomic Sciences
Mount Sinai School of Medicine

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to