title: Get row and column name of data.frame according to condition in R
body: <p>This is probably much easier than I am making it. It is one of those little problems which hangs you up and you wonder why.</p>
  
  <p>Given dataframe as so:</p>
  
  <pre><code>a &lt;- c(1,2,3)
  b &lt;- c(4,5,6)
  test.df &lt;- data.frame(a,b)
  </code></pre>
  
  <p>How could one use iterate through the values in each column and return the column name and row name if the value = '1'?</p>
  
  <p>Something like this:</p>
  
  <pre><code>for (i in test.df) {
      for (j in i) {
          if (i == 1) {
              print(rowname,columnname)
              }
          }
      }  
  }  
  </code></pre>
  
  <p>Where rowname and columnname are actual values.</p>