title: R - Multiple variables in for loop?
body: <p>How can I create a <code>for</code> loop in R which considers two variables?</p>
  
  <p>Something like:</p>
  
  <pre><code>for(i in 1:10, j in 1:10) {
  if vector[j] == vector2[i]
  print(variable)
  else print(NA) }
  </code></pre>
  
  <p>This should give me 100 outputs, as opposed to using </p>
  
  <pre><code>vector[i] == vector[i]
  </code></pre>
  
  <p>which would generate 10.</p>
  
  <p>EDIT:
  Thanks for yor help so far. here is my actual data:</p>
  
  <pre><code>for(i in 1:10) {
      for(j in 1:10) {
          if (i == j)
          print(NA)
          else if(st231_eq1_alg$Output[j] == st231_eq1_alg$Input[i])
          print(st231_eq1_alg_f[i])
          else if(st231_eq1_alg$Output[j] == st231_eq1_alg$Output[i])
          print(st231_eq1_alg_inv_f[i])
          else print(NA)
      }
  }
  </code></pre>
  
  <p>Any ideas how best to represent these outputs? Thanks again.</p>