title: Throw away first and last n rows
body: <p>I have a <code>data.table</code> in R where I want to throw away the first and the last n rows. I want to to apply some filtering before and then truncate the results. I know I can do this this way:</p>
  
  <pre><code>example=data.table(row1=seq(1,1000,1),row2=seq(2, 3000,3))
  e2=example[row1%%2==0]
  e2[100:(nrow(e2)-100)]
  </code></pre>
  
  <p>Is there a possiblity of doing this in one line? I thought of something like:</p>
  
  <pre><code>example[row1%%2==0][100:-100]
  </code></pre>
  
  <p>This of course does not work, but is there a simpler solution which does not require a additional variable?</p>