Skip to content

Instantly share code, notes, and snippets.

@pedroj
Created February 20, 2012 23:37
Show Gist options
  • Select an option

  • Save pedroj/1872314 to your computer and use it in GitHub Desktop.

Select an option

Save pedroj/1872314 to your computer and use it in GitHub Desktop.
Ordering matrices. Web must be a matrix with 'dimnames'
#--------------------------------------------------------------
# Ordering matrices. Web must be a matrix with 'dimnames'
#--------------------------------------------------------------
mat.ord <- function(web) {
web.ord <- web[order(rowSums(web), decreasing = TRUE),
order(colSums(web), decreasing = TRUE)]
web.ord
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment