[R] combination of columns in a matrix

2013-06-14 Thread Hermann Norpois
Hello, I have a matrix m and I want to know how often does 1 (or !0) simultanously appear in A and REF, B and REF, C and REF. So actually I wish to automate following expression: length (which (m[,1]!=0m[,4]!=0)) [1] 2 length (which (m[,2]!=0m[,4]!=0)) [1] 1 Thanks Hermann m A B C REF

Re: [R] combination of columns in a matrix

2013-06-14 Thread arun
] combination of columns in a matrix Hello, I have a matrix m and I want to know how often does 1 (or !0) simultanously appear in A and REF, B and REF, C and REF. So actually I wish to automate following expression: length (which (m[,1]!=0m[,4]!=0)) [1] 2 length (which (m[,2]!=0m[,4]!=0)) [1] 1