Re: [R] Creating a maxtrix from conditional prints

2010-06-05 Thread Joris Meys
Use rbind? Not the most optimal solution, but it should get the job done. # not tested Code example: out - c() for (x in 1:10) { for (y in 1:10) { qui - ifelse((mac[,1] == x) (mac[,5] == y) | (mac[,1] == y) (mac[,5] == x), 1, NA) quo - cbind(mac,qui) qua - subset(quo, qui ==1) if(nrow(qua) ==

[R] Creating a maxtrix from conditional prints

2010-06-04 Thread EM
Hi guys :) I'm dealing with this problem, perhaps conceptually not that complex, but still - I'm stuck. Two columns, values 1x10, only integers. I want to check when the first column's index is identical to the second's (and vice versa). If that's true, I want to add a further column with value