https://github.com/cran/MADPop
Raw File
Tip revision: f39285a5c57bca1379778c107683f8a33af4b97d authored by Martin Lysy on 27 February 2024, 00:30:02 UTC
version 1.1.7
Tip revision: f39285a
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