Suppose I have
arr = 2 1 3 1 2 3 1 1 2
How can I sort this into the below?
arr = 1 1 2 1 2 3 2 1 3
I had a similar problem, and solution seems to be simple and elegant:
t(apply(t(yourMatrix),2,sort))