search for: sortmat

Displaying 3 results from an estimated 3 matches for "sortmat".

2000 Jul 13
2
Programming puzzle...
Dear R guru's, I'd like to sort the columns of a matrix according to the elements in the first row, and in case of a tie according to the second row, etc. In case of a 3xn matrix woppa, something like colorder _ order(woppa[1,], woppa[2,], woppa[3,]) I just cannot seem to find a way to do this for a variable number of rows, e.g. if woppa has 10 or 15 rows I now manually cut and paste to
1999 Oct 13
1
Q: sort a matrix by picking up columns?
Hi, I am wondering how to write a function which sorts a matrix by giving a vector of column numbers. Suppose we have a matrix (or data frame) "Mat" and I want to obtain order(Mat[,1], Mat[,3], Mat[,6,], Mat[,8], Mat[,10], Mat[,13]) in order to sort the matrix by those columns. Is there a way to write a function so that I can give a vector of the column numbers c(1,3,6,8,10,13) and do
2004 Jul 20
9
Sort a data frame
Hi all I have the next data frame year STOD SLAGNR TAL TALT TALVEKT 1 2002 2120006 57 1 NA 1 2 1997 97030032 57 NA NA NA 3 1997 97030071 27 1 NA NA 4 1997 97030005 57 1 NA NA 5 1997 97020127 60 NA 1 NA 6 2001 1160025 27 1 NA 1 7 1998 98020069 60 1 NA NA 8