title: R How to slice a data.table according to a date into a list
body: <p>I have a data.table like this</p>
  
  <pre><code>Date          Rain      Temp
  1990-01-01    0.0       29.2
  1990-03-03    0.0       30.4
  1990-06-10    NA        25.2 
  1990-09-02    0.3       26.8
  1991-01-04    0.1       31.2
  1991-03-02    0.0       34.0
  1991-06-01    5.4       27.1 
  1991-09-01    0.4       25.1
  1992-01-09    0.0       30.8
  1992-03-03    0.0       30.7
  1992-06-03    4.6       23.1
  1992-09-03    0.8       29.1
  </code></pre>
  
  <p>But bigger, lots of lines and sometimes the years have different numbers of rows. I need to slice it every time the year changes and save the result to a list:</p>
  
  <pre><code>[[1]]
      Date          Rain      Temp
      1990-01-01    0.0       29.2
      1990-03-03    0.0       30.4
      1990-06-10    NA        25.2 
      1990-09-02    0.3       26.8
  [[2]]
      Date          Rain      Temp
      1991-01-04    0.1       31.2
      1991-03-02    0.0       34.0
      1991-06-01    5.4       27.1 
      1991-09-01    0.4       25.1
  [[3]]
      Date          Rain      Temp
      1992-01-09    0.0       30.8
      1992-03-03    0.0       30.7
      1992-06-03    4.6       23.1
      1992-09-03    0.8       29.1
  </code></pre>
  
  <hr>
  
  <p>What I'm doing until now:</p>
  
  <pre><code>yearly.data &lt;- list
  dates.intervals &lt;- list(c("1990-01-01","1990-12-31"),
                          c("1991-01-02","1991-12-31"),
                          c("1992-01-02","1992-12-31"))
  
  for (y in dates.intervals){
      yearly.data &lt;- c(yearly.data, list(data[Date %between% y]))
  }
  </code></pre>
  
  <p>But this way, the result is</p>
  
  <pre><code>yearly.data
  [[1]]
  function (...)  .Primitive("list")
  
  [[2]]
        Date          Rain      Temp
      1990-01-01    0.0       29.2
      1990-03-03    0.0       30.4
      1990-06-10    NA        25.2 
      1990-09-02    0.3       26.8
  ...
  ...
  </code></pre>
  
  <p>I can't take out that value from <code>[[1]]</code>, but this is not my main concern. My main concern is that I think there must be a much more efficient way to do this, but I can't find it.</p>