Re: [R] Ordering every row of a matrix while ignoring off diagonal elements

2011-04-03 Thread jim holtman
I assume that this is what you did, and I would not call that cheating; it is just a reasonable way to solve the problem: > x <- as.matrix(read.table(textConnection(" 0.00 2.384158 2.0065682 > 2.2998856 + 2.384158 0.00 1.4599928 2.4333213 + 2.006568 1.459993 0.000 0.9733285 + 2.299886

[R] Ordering every row of a matrix while ignoring off diagonal elements

2011-04-03 Thread Vivian Shih
Sorry if this is a stupid question but I've been stuck on how to code so that I can order rows of a matrix without paying attention to the diagonal elements. Say, for example, I have a matrix d: d [,1] [,2] [,3] [,4] [1,] 0.00 2.384158 2.0065682 2.2998856 [2,] 2.3