Sorry if this is very basic. I have a list of names and a matrix with those names as column names. However, the colnames are in a different order.
Eg. List of name
You just have to use a vector for the names and the [-operator as follows:
[
col.order <- c("colname4","colname3","colname2","colname5","colname1") M[,col.order]