title: reshape time series into panel in r
body: <p>Now I have time series GDP data for 3 countries. I would like to create a panel for dataset, for further panel analysis. I don't understand how to create it whith reshape package a plm.</p>
  
  <pre><code>           AT      CZ       DE
   1995    68410.7 30457.3 630631.5
   1995.25 68353.5 30213.1 625515.3
   1995.5  68103.3 29766.4 623124.0
   1995.75 67896.0 29661.8 621122.0
   1996    67888.8 29595.8 616673.1
   1996.25 67874.5 29880.0 616645.4
  </code></pre>
  
  <p>I've found that I can reshape data in such way:</p>
  
  <pre><code>long &lt;- reshape(as.data.frame(GDP.series),varying = list(names(GDP.series)), v.names="GDP",
              timevar = "Country", idvar = "time", ids = row.names(GDP.series),
              times = names(GDP.series),   new.row.names = 1:((dim(GDP.series)[2])*(dim(GDP.series)[1])),direction = "long")
  </code></pre>
  
  <p>And after that data are in looks like:</p>
  
  <pre><code>    Country     GDP
   1      AT 49149.0
   2      AT 49555.5
   3      AT 49475.9
   4      AT 49507.6
   5      AT 49888.9
   6      AT 50324.5
  </code></pre>
  
  <p>But the problem with this transformation is that the infromation about time periods is lost. I'm quite beginner, and not everything in code behind is understable for me, especially this part:</p>
  
  <pre><code>  "new.row.names = 1:((dim(GDP.series)[2])*(dim(GDP.series)[1])),direction = "long""
  </code></pre>
  
  <p>So know my question is <strong>how to improve/change code</strong> in case data have following format:</p>
  
  <pre><code>       Country     GDP
  2013       AT 49149.0
  2012.75    AT 49555.5
  2012.5     AT 49475.9
  2012.25    AT 49507.6
  2011       AT 49888.9
  2011.75    AT 50324.5
  </code></pre>
  
  <p>Or if I need to use some other function? Thank you in advance.
  (Code is taken from this topic: <a href="https://stackoverflow.com/questions/18541269/data-transformation-in-r-for-panel-regression">Data Transformation in R for Panel Regression</a>)</p>