R data.table: check which column is not NA and get the value of this column
<p>I have a data.table similar to this one:</p>

<pre><code>      gnr  konf_prot  konf_kath       konf_andere  konf_ohne
   1: 1136        NA  #F16913         NA           NA
   2: 1150        NA  #F16913         NA           NA
   3: 2890   #9E9AC8       NA         NA           NA
   4: 4401        NA  #FEE6CE         NA           NA
   5: 2427        NA       NA         #FD8D3C      NA
</code></pre>

<p>It has a ID column (gnr) and some columns containing color codes. In each row, only one column has a color value, all the others are NA.</p>

<p>What I want is a new data.table with just two columns: <code>gnr</code> and <code>colorcode</code>. Colorcode contains the color value that appears in one of the other columns within this row.
So I need a function that checks which column is not NA and then assigns this color value to the new column colorcode.</p>

<p>Thanks for any help!</p>