title: Append column names as a row value
body: <p>suppose I have the following data frame. The idea is to be able to extract the names of the columns that contain a "1" as a value, and append them in a new data frame with the same "id".</p>
  
  <pre><code>db&lt;-data.frame(id=c(1,2,3,4,5,6),col1=c(0,0,0,1,0,1),col2=c(0,0,1,1,0,0),col3=c(0,0,0,0,0,1),col4=c(1,0,0,0,0,0))
  
    id col1 col2 col3 col4
  1  1    0    0    0    1
  2  2    0    0    0    0
  3  3    0    1    0    0
  4  4    1    1    0    0
  5  5    0    0    0    0
  6  6    1    0    1    0
  
  db2&lt;-data.frame(id=c(1,2,3,4,5,6),cols=c("col4","-","col2","col1,col2","-","col1,col4"))
  
    id      cols
  1  1      col4
  2  2         -
  3  3      col2
  4  4 col1,col2
  5  5         -
  6  6 col1,col3
  </code></pre>