I am looking to order my columns by name. I know that I can do the following: portManDMA = portManDMA[,c(1,2,6,7,8,9,10,3,4,5,11,12,13,14,15,16,17,18,19)]
to reorder the columns, but what I would like to do is actually use the column name in the ordering. For example:
## OriginalMatrix
DEF ABC KLM HIJ
Where each 3 letters represent a column name. I would like then reorder them based on the columns names, something like portManDMA = portManDMA[,c("ABC","KLM","DEF","HIJ")]
, for example, so that the new ordering would then be:
## NewMatrix
ABC KLM DEF HIJ
Would anyone be able to help me with this?