title: Reshape data from long to wide with multiple explained variables
body: <p>I'm trying to convert my data frame format using R. I want unique company name as it has multiple observations for each company. My data looks like</p>
  
  <pre><code>company name    Values  Year
      A              1    2010
      A              2    2011
      B              4    2010
      B              6    2012
      C              8    2011
  </code></pre>
  
  <p>I want below format</p>
  
  <pre><code> company name   first_value First_year  second_values second_year
       A              1          2010          2           2011
       B              4          2010          6           2012  
       C              8          2011          NA           NA
  </code></pre>
  
  <p>I have tried this code but it is not giving result what I am expecting</p>
  
  <pre><code>library(plyr)
  extract.hashtags &lt;- function(x) {
  x &lt;- subset(x,select=c(-Company.Name))
  mat &lt;- as.matrix(x)
  dim(mat) &lt;- c(1,length(mat))
  as.data.frame(mat)
  }
  
  df1 = ddply(data, .(Company.Name), extract.hashtags )
  </code></pre>