title: Reducing multiple rows to 1 by index in R
body: <p>I am relatively new to R. I am working with a dataset that has multiple datapoints per timestamp, but they are in multiple rows. I am trying to make a single row for each timestamp with a columns for each variable.</p>
  
  <p>Example dataset</p>
  
  <pre><code>Time    Variable    Value
  10      Speed       10
  10      Acc         -2
  10      Energy      10
  15      Speed       9
  15      Acc         -1
  20      Speed       9
  20      Acc         0
  20      Energy      2
  </code></pre>
  
  <p>I'd like to convert this to </p>
  
  <pre><code>Time    Speed    Acc    Energy
  10      10       -2     10
  15      9        -1     (blank or N/A)
  20      8         0     2
  </code></pre>
  
  <p>These are measured values so they are not always complete.</p>
  
  <p>I have tried ddply to extract each individual value into an array and recombine, but the columns are different lengths. I have tried aggregate, but I can't figure out how to keep the variable and value linked. I know I could do this with a for loop type solution, but that seems a poor way to do this in R. Any advice or direction would help. Thanks!</p>