Shortcuts in Science
Friday, 11 August 2017
R Order Data Frame by Multiple Columns
Cited from
Order a matrix by multiple column in r
set.seed(2013) # preparing my example
mat <- matrix(sample.int(10,size = 30, replace = T), ncol = 3)
mat[do.call(order, as.data.frame(mat)),]
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment