title: How to select the n first rows for each factor in a datatable?
body: <p>I would like to select the first few rows for each factor in a datatable. </p>
  
  <pre><code>SOURCE=data.table(NAME=rep(paste0("NAME", as.character(1:3)), each=5), VALUE=sample(c(TRUE,FALSE), 5*3, TRUE) )
  &gt; SOURCE
       NAME VALUE
   1: NAME1  TRUE
   2: NAME1  TRUE
   3: NAME1  TRUE
   4: NAME1 FALSE
   5: NAME1 FALSE
   6: NAME2  TRUE
   7: NAME2 FALSE
   8: NAME2  TRUE
   9: NAME2  TRUE
  10: NAME2  TRUE
  11: NAME3  TRUE
  12: NAME3 FALSE
  13: NAME3 FALSE
  14: NAME3  TRUE
  15: NAME3  TRUE
  </code></pre>
  
  <p>For instance here I'd like to select the 3 first rows for each <code>NAME</code> so I would end up with rows : 1-3, 6-9 and 11-13. Any idea how to do that ?</p>
  
  <p>I tried this but it doesn't work : </p>
  
  <pre><code>&gt; SOURCE[1:3, VALUE, by=NAME]
      NAME VALUE
  1: NAME1  TRUE
  2: NAME1  TRUE
  3: NAME1  TRUE
  </code></pre>