title: R: Convert rows with multiple columns to rows with just two colums (row ID and data point)
body: <p>I am very new to R, and trying to reconfigure a large dataframe (several million records) to permit analysis.  </p>
  
  <p>The dataframe looks like:</p>
  
  <pre><code>ID   Dx1   Dx2   Dx3 .....Dx33
  1    12    11    0 
  2    3     1     2
  3    44    9     6  
  </code></pre>
  
  <p>I need to convert it to look like</p>
  
  <pre><code>ID   Dx
  1    12
  1    11
  1    0
  2    3
  2    4
  </code></pre>
  
  <p>etc..</p>
  
  <p>Assistance with this would be greatly appreciated.
  Thanks!</p>
  
  <p>In case anyone is interested:
  The dataframe has a subject ID number and 1 to 33 associated ICD10 codes (diagnosis codes).   I plan to use the Comorbidity package (<a href="https://github.com/ellessenne/comorbidity" rel="nofollow noreferrer">https://github.com/ellessenne/comorbidity</a>) to calculate Elixhauser scores for each subject.  Comorbidity requires the data to be in this format.</p>