title: Count the months between two dates in a data.table
body: <p>I have a <code>data.table</code> like the following:</p>
  
  <pre><code>ID   start_date   end_date
  1    2015.01.01   2016.02.01 
  2    2015.06.01   2016.03.01
  3    2016.01.01   2017.01.01
  </code></pre>
  
  <p>I would like to get the following:</p>
  
  <pre><code>ID   start_date   end_date    Months_passed
  1    2015.01.01   2016.02.01  13
  2    2015.06.01   2016.03.01   9
  3    2016.01.01   2017.01.01  12
  </code></pre>
  
  <p>I was trying the following code:</p>
  
  <pre><code>DT[, Months_passed:= length(seq(from = start_date, to = end_date, by='month')) - 1]
  </code></pre>
  
  <p>but I get the error, that </p>
  
  <blockquote>
    <p>"Error in seq.Date(from = start_date, to = end_date, by = "month") : 
      'from' must be of length 1"</p>
  </blockquote>