Logical operators in if-else in R
问题 I have the following table (5 columns and 3 rows) called mat : AC CA RES 1 0 2 2 1 3 0 0 0 1 The operation being performed is mat[1]/mat[1]+mat[2] I am testing for the following : 1) If both columns of a row are zero, the result should be NA. 2) If only one column of a row is zero and the other has a non-zero number, proceed with calculation. (Even if the numerator is 0, that's okay) I am currently using this if-else structure within a for-loop going row-wise: if(mat[b,1]>=0|mat[b,2]>=0){mat