title: Map date column to unique sequential numbers starting from 1 in R
body: <p>I have a column of dates in a dataframe, where each of the dates usually repeats a couple of times. Here is an example of my dataframe, which also has the names of some sports teams in other columns:</p>
  
  <pre><code>dput(mydf)
  structure(list(date_game = structure(c(15643, 15643, 15643, 15644, 
  15644, 15644, 15646, 15646), class = "Date"), team_id = c("WAS", 
  "CLE", "LAL", "SAC", "CHI", "DET", "BOS", "MIL"), fran_id = c("Wizards", 
  "Cavaliers", "Lakers", "Kings", "Bulls", "Pistons", "Celtics", 
  "Bucks")), .Names = c("date_game", "team_id", "fran_id"), row.names = c(1L, 
  2L, 3L, 7L, 8L, 9L, 29L, 30L), class = "data.frame")
  </code></pre>
  
  <p>In this case, mydf has 3 unique dates, and skips a date as well. My full dataframe has hundreds of unique dates. For this example, I am interested in adding a new column to the dataframe (call it date_number), that would look like this:</p>
  
  <pre><code>mydf
      date_game team_id   fran_id  date_number
  1  2012-10-30     WAS   Wizards            1
  2  2012-10-30     CLE Cavaliers            1
  3  2012-10-30     LAL    Lakers            1
  7  2012-10-31     SAC     Kings            2
  8  2012-10-31     CHI     Bulls            2
  9  2012-10-31     DET   Pistons            2
  29 2012-11-02     BOS   Celtics            3
  30 2012-11-02     MIL     Bucks            3
  </code></pre>
  
  <p>Like the title says - starting with 1 in the date_number column, I would like increasing, sequential numbers for the dates. The key part of this is that the column is sequential, even if certain dates are missing. Although 11-01 is not there, 11-02 still gets set to 3, not 4.</p>
  
  <p>Any thoughts on how to do this would be greatly appreciated! </p>