title: How to calculate hours between two as.characters with the format "dd-mm-yyyy hh:mm"
body: <p>I have <code>u</code> with <code>time1</code> and <code>time2</code> both listed with the format <code>dd-mm-yyyy hh:mm</code>. I would like to produce a new covariate containing the <code>hours</code> between <code>u$time1</code> and <code>u$time2</code>.</p>
  <p>They are listed as <code>as.character</code></p>
  <pre><code>str(u)
  'data.frame':   5765 obs. of  2 variables:
   $ time1: chr  &quot;30-01-2020 07:20&quot; &quot;25-04-2019 15:05&quot; &quot;11-01-2019 22:01&quot; &quot;11-01-2019 22:01&quot; ...
   $ time2: chr  &quot;14-02-2020 15:34&quot; &quot;27-04-2019 10:56&quot; &quot;12-01-2019 00:42&quot; &quot;23-01-2019 10:08&quot; ...
  </code></pre>
  <p>The expected output</p>
  <pre><code>&gt;  head(u)
               time1            time2                            new
  1 30-01-2020 07:20 14-02-2020 15:34  hours between time1 and time2
  2 25-04-2019 15:05 27-04-2019 10:56  hours between time1 and time2
  3 11-01-2019 22:01 12-01-2019 00:42  hours between time1 and time2
  4 11-01-2019 22:01 23-01-2019 10:08  hours between time1 and time2
  </code></pre>
  <p>I would prefer if the hours had one decimal point, and a solution with <code>dplyr</code> or <code>lubridate</code> would be preferred.</p>
  <pre><code>u &lt;- structure(list(time1 = c(&quot;30-01-2020 07:20&quot;, &quot;25-04-2019 15:05&quot;, 
  &quot;11-01-2019 22:01&quot;, &quot;11-01-2019 22:01&quot;, &quot;17-04-2018 07:55&quot;), 
      time2 = c(&quot;14-02-2020 15:34&quot;, &quot;27-04-2019 10:56&quot;, &quot;12-01-2019 00:42&quot;, 
      &quot;23-01-2019 10:08&quot;, &quot;20-04-2018 11:04&quot;)), row.names = c(NA, 
  5L), class = &quot;data.frame&quot;)
  </code></pre>