try sort (table(MAT), decreasing=T) if MAT is your matrix I think this is what you want. though if you want to sort by the first occurrence then it is a different story. Nikhil On 2 Nov 2009, at 1:35PM, Val wrote: > V1 v2 v3 v4 > > 5 6 9 10 > > 3 4 7 10 > > 4 6 10 18