R sorting column -


i have file several column loaded in r. want achieve order column of file respect minimal value in each of column. e.g.

input(mina=0,minb=3,minc=1)
b c
4 8 1
2 3 4
0 3 1

output
b c
4 1 8
2 4 3
0 1 3

you might try apply() way:

mins <- apply(mydata, 2, min) o <- order(mins) mydata <- mydata[,o] 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -