title: Sort month and year in R
body: <p>I want to sort the month-year data in r, I tried using this</p>
  
  <pre><code>Data_Full$Year_Month &lt;- paste(Data_Full$Year, Data_Full$Month, sep = "")
  for(i in 1: length(Data_Full$Year_Month)){
  
    if(length(Data_Full$Year_Monthi[i] == 5)){
      Data_Full$Year_Month[i] &lt;- paste(substr(Data_Full$Year_Month[i], 1, 4), "0", substr(Data_Full$Year_Month[i], 5, nchar(Data_Full$Year_Month[i])), sep = "")
  
    } else
  
    {
      Data_Full$Year_Month[i] &lt;- Data_Full$Year_Month[i] 
  
    }
    i
  
  }
  </code></pre>
  
  <p>Once I get this I will sort it, but I unable to do it</p>