From: Serguei Kaniovski <kaniovsk_at_wsr.ac.at>

Date: Tue 06 Dec 2005 - 21:43:06 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 06 22:03:06 2005

Date: Tue 06 Dec 2005 - 21:43:06 EST

Hello,

Being new to R, I am completely stuck with the following problem. Please help to find a general solution to the following matrix task: Given:

N<-4

input_mat<-matrix(c(1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,

1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0),ncol=N) combin_mat<-matrix(c(1, 2, 1, 3, 1, 4, 2, 3, 2, 4, 3, 4),ncol=choose(N,2))

Find the indices of rows in "input_mat", whose elements indicated by the
pair of elements in each column of "combin_mat", are equal 1. So, for
the first

column of combin_mat (1,2) the answer should be 1,2,3, and 4th row of

"input_mat" has 1 as the first and second element, for the secondcolumn

of combin_mat (1,3) the answer should be 1,2,5,6, for the third column
of combin_mat (1,4) the answer should be 1,3,5,7, an so on.

"input_mat" is the matrix of binary representations of the first 2^N-1

decimals in the descending order, here N=4, so 7,6,...,0. "combin_mat"
is the matrix of all combinations of N by 2.

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 06 22:03:06 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:41:29 EST
*