title: R data frame: Transposing rows into a column in a cycle
body: <p>I am in a bit of a program block with the restructuring of my data frame.</p>
  
  <p>I have a following data frame structure:</p>
  
  <pre><code>&gt; nrow(data)
  [1] 731
  &gt; ncol(data)
  [1] 25
  
  HE01 HE02 HE03 ... HE24 HE25
  1)value1 value 2 value 3 ... value 24 value 25
  ...
  731) value 1 value 2 value 3 ... value 24 value 25
  </code></pre>
  
  <p>My purpose is to restructure the data in the following way:
  1) putting the column names in a specific column in the front
  2) inserting the values from every row in a column next to each of the corresponding column names and this in a cycle from 1 to 25 and then again. </p>
  
  <p>Somehow like this:</p>
  
  <pre><code>HE01 value 1
  HE02 value 2
  ...
  HE25 value 25
  and again for row number two
  HE01 value 1
  ...
  HE25 value 25
  and again in this pattern till row number 731
  </code></pre>
  
  <p>I assume this could be done with some sort of a loop but can't figure out exactly how. </p>
  
  <p>Thank you for your answers in advance. </p>