[R] Order all the columns ascending elements on a matrix or a data frame

Trying To learn again tryingtolearnagain at gmail.com
Sun Jun 10 08:36:42 CEST 2012


Imagine I have a csv KT.csv

I want to create a new dataframe o convert KT in a matrix and create a new
matrix with each column of KT ordered by ascending order.

I have tried to make this

b<-read.csv("KT.csv")


for(i in 1:ncol(b)){

b[,i]<-sort(b[,i])

}

But it puts a message that the number of rows doesn´t correspond.

Can someone give me a clue on how to order.

Many Thaks.


More information about the R-help mailing list