gistlib
# Create a matrix mat <- matrix(1:12, nrow = 3, byrow = TRUE) # Sort row order as column order sorted_mat <- mat[,order(col(mat))] sorted_mat 144 chars8 lines
# Create a matrix mat <- matrix(1:12, nrow = 3, byrow = TRUE) # Sort row order as column order sorted_mat <- mat[,order(col(mat))] sorted_mat
The sorted_mat will be the matrix with row order as the column order.
sorted_mat
gistlibby LogSnag