title: Should year variable be factor or numeric in panel data in R?
body: <p>I have a panel dataset where hospitals are followed over time from 2004 to 2010 every two years. The data is in Stata but I take it to R. Initially the variables <code>year</code> (2004, 2006, 2008, 2010) and <code>t</code> (1=2004, 2=2006 and so on) are in integer but later I convert them into factors as follows: </p>
  
  <pre><code>data$year &lt;- factor(data$year)
  </code></pre>
  
  <p>and similarly for t time variable as well. </p>
  
  <p>But I am confused and my question is as to whether take <code>year</code> or <code>t</code> as an integer or numeric variable or convert it to factor for the panel data and whether the above command is the right way to convert into a factor?</p>