Re: [R] Conditional Evaluation

2011-09-26 Thread Dennis Murphy
Hi: The problem is that in your example, you have unequal numbers of rows in B that match the 1's pattern in A[i, ]. The function below cycles through the rows of A and returns, for each row of A, the rows in B that have 1's in the same columns as A[i, ]. By necessity, this returns a list. Notice

[R] Conditional Evaluation

2011-09-26 Thread Thiem Alrik
Dear mailing list, how can I identify all those rows of matrix B which fulfill some condition based on another matrix A? More precisely, A <- matrix(c(1, 1, 0, 1, -9, 1, -9, 1, 0, 0, 1, 1, 0, -9, 1, 0, -9, 0, 1, 1, 1, -9, 1, 1, 1), ncol = 5, byrow = TRUE) B <- matrix(c(0,0,1,0,0,0,1,1,0,0,0,0