Learn R Programming

ggbrain (version 0.9.0)

sort_mat: Sort Matrix by Column

Description

Sorts a given matrix by a specific column while retain the elements in each row.

Value

The matrix sorted by values in the specified column.

Arguments

x

A matrix to sort

col

A int that indicates the column the matrix should sort by.

Details

This functions sorts a matrix based on one column, keeping the rows together. Note that col should be a zero-based index of x (i.e., first column is 0).