title: If multiple condition not giving output in r
body: <p>I have a dataframe</p>
  
  <pre><code>df= data.frame(ID=paste(rep("a",7),c(1:7),sep = ""),
                 col2=c(12,10,1,2,5,10,8),
                 col3=c(200,150,180,450,100,130,200))
  </code></pre>
  
  <p>I'm trying to check a combination of those element that <strong>sum upto a particular number AND for those same elements checking a sumproduct</strong> 
  But it is not giving any output
  For e.g from dataframe <strong>df</strong> these values make a sum of 25, so</p>
  
  <pre><code>  col2  col3
      10   150
      5    100
      10   130
  
  =sumproduct((E3:E5,D3:D5) [excel formula] 
  output = 3300
  </code></pre>
  
  <p>And this is I expect as output from following code <code>a2,a5,a6</code></p>
  
  <p>This is my code</p>
  
  <pre><code>for(i in 1:nrow(df)){
    comb &lt;- combn(1:nrow(df), i, FUN = NULL, simplify = TRUE)
    for (j in 1:ncol(comb)){
      subvec &lt;- comb[,j]
      a &lt;- sum(df[subvec,2])
  
       b &lt;- sum(df[i, 2] * df[i, 3])
      if(a == 25 &amp;&amp; b == 3300){
        print(df[subvec,1])
      }
    }
  }
  </code></pre>