title: Make dates into ordinal variables
body: <p>I'm working with dates in R, and I want to convert the dates into a number that represents how many attempts it took for a participant to pass a test. Some participants took multiple attempts, and others took just one. Furthermore, some took the test years before others, so I don't care about the date, just if it was time one or time two, etc.</p>
  
  <p>Here's a mock dataset:</p>
  
  <pre><code>library(dplyr)
  library(lubridate)
  problem &lt;- tibble(name = c("Britney", "Christina", "Justin", "Britney", "Britney", "Christina", "Christina", "Christina"),
                    score = c(1, 2, 3, 3, 3, 2, 4, 2),
                    date = ymd_hms(c("2019-02-26 00:18:09", "2019-04-26 00:18:09", "2019-02-20 00:18:09", "2018-02-26 00:18:09", "2017-02-26 00:18:09", "2016-02-26 00:18:09", "2015-02-26 00:18:09", "2010-02-26 00:18:09")))
  </code></pre>
  
  <p>And here's what I want it to look like in the end:</p>
  
  <pre><code>solution &lt;- tibble(name = c("Britney", "Christina", "Justin", "Britney", "Britney", "Christina", "Christina", "Christina"),
                    score = c(1, 2, 3, 3, 3, 2, 4, 2),
                    date = ymd_hms(c("2019-02-26 00:18:09", "2019-04-26 00:18:09", "2019-02-20 00:18:09", "2018-02-26 00:18:09", "2017-02-26 00:18:09", "2016-02-26 00:18:09", "2015-02-26 00:18:09", "2010-02-26 00:18:09")),
                    order = c(3, 4, 1, 2, 1, 3, 2, 1))
  
  solution
  </code></pre>
  
  <p>Thank you!</p>