<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Sudhir,<br>
      Read the documentation for R function `as.Date()`, e.g. you can
      transform your factor column to a date column using
      `as.Date(my_date, format = "%d%b'%Y")`, then order/sort on that
      column.</p>
    <p>I guess what you're looking for is:</p>
    <p>dt[, my_date := as.Date(paste(1, my_date), format = "%d %b'%Y")]<br>
      month_seq <- seq("2006-04-01", "2014-08-01", "month")<br>
      dt_month <- data.table(month_int=1:length(month_seq),
      month_seq=month_seq)<br>
      setkey(dt, my_date)<br>
      setkey(dt_month, month_seq)<br>
      dt[dt_month, my_date_int := month_int]<br>
    </p>
    <p>--Mel.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 12/7/2016 7:14 PM, jim holtman
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAAxdm-6Bq0EV50qRnGONPs1NLkGGF_mdLivg5+K4YpdCWJicXw@mail.gmail.com">
      <div dir="ltr">Please at least supply a sample of the data.  Is
        there more than one row per month, are there months missing, if
        so how to handle.  You left a lot unspecified.  Guidance can be
        provided with data.</div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature" data-smartmail="gmail_signature"><br>
            Jim Holtman<br>
            Data Munger Guru<br>
             <br>
            What is the problem that you are trying to solve?<br>
            Tell me what you want to do, not how you want to do it.</div>
        </div>
        <br>
        <div class="gmail_quote">On Tue, Dec 6, 2016 at 1:34 PM,
          kbsudhir <span dir="ltr"><<a
              href="mailto:kbsudhir@gmail.com" target="_blank"
              moz-do-not-send="true">kbsudhir@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
            <br>
            I am a beginner in R.<br>
            <br>
            I have a period of dates in my data set starting 10th
            April'2006 till 31st<br>
            Aug'2016. Its a period of 125 months. I want to sequentially
            identify each<br>
            month with a number starting "1" in a new corresponding
            column Ex<br>
            "Month_Identifier". Ex<br>
            Apr'2006 - 1<br>
            May'2006 - 2 ........ Aug'2016 - 125<br>
            <br>
            Also, the datatype of the column where date is available is
            a factor.<br>
            <br>
            Requesting guidance on how to achieve this.<br>
            <br>
            Regards<br>
            Sudhir<br>
            <br>
            <br>
            <br>
            --<br>
            View this message in context: <a
href="http://r.789695.n4.nabble.com/Sequential-numbering-for-each-month-on-a-period-of-time-tp4727126.html"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://r.789695.n4.nabble.com/<wbr>Sequential-numbering-for-each-<wbr>month-on-a-period-of-time-<wbr>tp4727126.html</a><br>
            Sent from the datatable-help mailing list archive at
            Nabble.com.<br>
            ______________________________<wbr>_________________<br>
            datatable-help mailing list<br>
            <a href="mailto:datatable-help@lists.r-forge.r-project.org"
              moz-do-not-send="true">datatable-help@lists.r-forge.<wbr>r-project.org</a><br>
            <a
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/datatable-help</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
datatable-help mailing list
<a class="moz-txt-link-abbreviated" href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></pre>
    </blockquote>
    <br>
  </body>
</html>