【发布时间】:2015-12-28 22:41:59
【问题描述】:
我有一个 矩阵,它有超过 100 列。我想根据第一个 col 对矩阵进行 排序,然后是 sec col, ... 等。 我知道对于少量的 col,我可以使用 order 函数这样做:
test2 <- test[order(test[,1],test[,2],test[,3],test[,4], test[,5], test[,6]),]
如果我有超过 100 列并且我不需要指定 1 到 100 列,有没有一种有效的方法来做到这一点。也许使用循环或其他东西?
非常感谢! 伯尼斯
【问题讨论】: