Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Moshe Olshansky
y <- 2 - (x[,1] > x[,2]) you can also do cbind(x,y) if you wish. --- On Fri, 1/8/08, Gundala Viswanath <[EMAIL PROTECTED]> wrote: > From: Gundala Viswanath <[EMAIL PROTECTED]> > Subject: [R] Grouping Index of Matrix Based on Certain Condition > To: [EMAIL PROTECTED] > Received: Friday, 1 Aug

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Jorge Ivan Velez
Dear Gundala, Try this: x=as.matrix(read.table(textConnection(" 4.482909e-01 0.55170907 9.479594e-01 0.05204063 8.923553e-01 0.10764474 9.295003e-01 0.07049966 8.880434e-01 0.11195664 9.197367e-01 0.08026327 9.431232e-01 0.05687676 9.460356e-01 0.05396442 6.053829e-01 0.39461708 9.515173e-01 0.04

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Christos Hatzis
Try this: > x <- matrix(runif(20), ncol=2) > x [,1] [,2] [1,] 0.33119833 0.4797847 [2,] 0.01339784 0.5218626 [3,] 0.78975940 0.8597246 [4,] 0.60849015 0.5217248 [5,] 0.91779777 0.9364047 [6,] 0.88302538 0.3467961 [7,] 0.87565986 0.4029147 [8,] 0.51594479 0.9885018 [9,] 0.