Hello,
How to sort a matrix based on its column names and preserving the identical column names.

when I use mat [, sort(colnames(mat))], sort changes all column names to unique ones. for ex,  if the name of 2 columns is col, the 2nd will be changed to col.1 whereas I want to keep the col name for the two columns

col    col -> col   col.1

thanks

       
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.

	[[alternative HTML version deleted]]

