title: Loop over the rows and bring the column name in R
body: <p>This is my df:</p>
  <pre><code>    JU_FINANCIAMENTO PRE CRE MERITO_AUTOMATICO
  1                0   1   0                 0
  2                0   0   1                 0
  3                0   1   0                 0
  4                1   0   0                 0
  5                0   1   0                 0
  6                0   0   0                 1
  </code></pre>
  <p>I need to create a new column with the name of the column where the number 1 is presented, as follows</p>
  <pre><code>    JU_FINANCIAMENTO PRE CRE MERITO_AUTOMATICO       NEW_COLUMN
  1                0   1   0                 0                PRE
  2                0   0   1                 0                CRE
  3                0   1   1                 0                PRE
  4                1   0   0                 0   JU_FINANCIAMENTO
  5                0   1   0                 0                PRE
  6                0   0   0                 1                 NA
  </code></pre>
  <p>What I tried so far:</p>
  <pre><code>for (i in names(df)) {
    df &lt;- df %&gt;%
      mutate(NEW_COLUMN = ifelse(i == 1, paste(i), &quot;NAN&quot;))
  }
  </code></pre>
  <p>But i got this:
  Error: Can't bind data because some arguments have the same name</p>