https://github.com/cran/MADPop
Raw File
Tip revision: e49a4096bae13d7e75275c5a31c9a210bdd5ea44 authored by Martin Lysy on 04 April 2023, 14:00:10 UTC
version 1.1.5
Tip revision: e49a409
colSort.R
#' Matrix Sort
#'
#' Sorts a matrix by first column, breaking ties with second column, breaking those ties with 3rd, etc.
#'
#' @param X matrix to sort.
#' @return Same matrix with rows permuted according to sort order.
#' @keywords internal
colSort <- function(X) {
  if(!is.matrix(X)) return(sort(X))
  X[do.call(order, lapply(data.frame(X), c)),]
}
back to top