title: How to convert months as factors while still maintaining the months in sequence?
body: <p>I have a original data frame (df) containing data of around 10 years(1994-2003). The head(df) is as shown below:</p>
  
  <pre><code>Sl.no       Date Year Month Season            val1            val2     val3
  1     1 1993-12-01 1993   Dec Winter          21.0            16.0      3.0
  2     2 1994-01-01 1994   Jan Winter          21.0            15.5      0.0
  3     3 1994-02-01 1994   Feb Winter          21.0            18.5      0.0
  4     4 1994-03-01 1994   Mar Spring          30.0            24.0      1.9
  5     5 1994-04-01 1994   Apr Spring          35.5            27.0      0.5
  6     6 1994-05-01 1994   May Spring          36.0            30.0      1.5
  </code></pre>
  
  <p>since i wanted to convert Months as factors, so as to plot boxplot, i used:</p>
  
  <pre><code>df$Month &lt;- as.factor(format(df$Date, "%b"))
  levels(df$Month) &lt;- c("Jan","Feb","Mar", "Apr", "May", "Jun", "Jul",
  "Aug", "Sep", "Oct", "Nov", "Dec")
  </code></pre>
  
  <p>however the output appeared as below: (Months were not in sequence like original df)</p>
  
  <pre><code>Sl.no       Date Year Month Season          val1             val2      val3
  1     1 1993-12-01 1993   Mar Winter          21.0            16.0      3.0
  2     2 1994-01-01 1994   May Winter          21.0            15.5      0.0
  3     3 1994-02-01 1994   Apr Winter          21.0            18.5      0.0
  4     4 1994-03-01 1994   Aug Spring          30.0            24.0      1.9
  5     5 1994-04-01 1994   Jan Spring          35.5            27.0      0.5
  6     6 1994-05-01 1994   Sep Spring          36.0            30.0      1.5
  </code></pre>
  
  <p>so in the above df, it is noted that the months are distorted, which otherwise should be in sequence following the Date.</p>
  
  <p>so how can i rectify this problem? your help will be highly appreciated.
  kind regards</p>