sortmat | R Documentation |
Sort a square matrix This uses an iterative algorithm that swaps the rows and columns of a matrix to ensure the highest values are either in the middle or the bottom-right.
sortmat(mat, sorttype = c("diag", "center", "bottomright"))
mat |
Square numeric matrix to be sorted. |
sorttype |
Where the highest values should appear - "diag", "center", or "bottomright". |
A sorted square matrix.
Sercan Kahveci
mat<-matrix(rnorm(144),ncol=12,nrow=12)
mat<-mat+t(mat)
newmat1<-sortmat(mat,"bottomright")
newmat2<-sortmat(mat,"diag")
newmat3<-sortmat(mat,"center")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.