title: Reshaping wide to long with multiple values columns
body: <p>I need to reshape my wide table into long format but keeping multiple fields for each record, for example:</p>
  
  <pre><code>dw &lt;- read.table(header=T, text='
   sbj f1.avg f1.sd f2.avg f2.sd  blabla
     A   10    6     50     10      bA
     B   12    5     70     11      bB
     C   20    7     20     8       bC
     D   22    8     22     9       bD
   ')
  
  # Now I want to melt this table, keeping both AVG and SD as separate fields for each measurement, to get something like this:
  
   #    sbj var avg  sd  blabla
   #     A   f1  10  6     bA
   #     A   f2  50  10    bA
   #     B   f1  12  5     bB
   #     B   f2  70  11    bB
   #     C   f1  20  7     bC
   #     C   f2  20  8     bC
   #     D   f1  22  8     bD
   #     D   f2  22  9     bD
  </code></pre>
  
  <p>I have basic knowledge of using <code>melt</code> and <code>reshape</code>, but it is not obvious for me how to apply such reshaping in my case.</p>