title: In R, how to reformat to a long format, creating multiple "descriptive" columns
body: <p>I'm trying to reformat some incoming data in a data frame. It is read in in a wide format, in multiple columns, and I'd like to collapse it into a long format. I've used 'melt' to do this for other code I've written recently, but in this case, I want to break the measured vars into more than one column. For example, my data looks roughly like this:</p>
  
  <pre><code>Time   X-Mean   X-StdDev   Y-Mean   Y-StdDev
  1       value    value      value    value
  2       value    value      value    value
  3       value    value      value    value
  4       value    value      value    value
  5       value    value      value    value
  </code></pre>
  
  <p>Ideally, I'd like this data reformatted as follows:</p>
  
  <pre><code>Time    Axis     Meas    Value
  1       X        Mean    value
  1       X        StdDev  value
  1       Y        Mean    value
  1       Y        StdDev  value
  2       X        Mean    value
  2       X        StdDev  value
  2       Y        Mean    value
  2       Y        StdDev  value
  .....
  </code></pre>
  
  <p>From what I've read, it feels as though I should be using cast for this, but I can't work out what the syntax should be. I'm just discovering R at the moment, so any help would be appreciated!
  Thanks!</p>