title: R delete first and last x % of rows
body: <p>I have a data frame with 3 ID variables, then several values for each ID.</p>
  
  <pre><code>user   Log Pass  Value
  2       2   123     342
  2       2   123     543
  2       2   123     231
  2       2   124     257
  2       2   124     342
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     342
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     543
  4       3   125     231
  4       3   125     257
  </code></pre>
  
  <p>The start and end of each set of values is sometimes noisy, and I want to be able to delete the first few values. Unfortunately the number of values varies significantly, but it is always the first and last 20% of values that are noisy. </p>
  
  <p>I want to delete the first 20% of rows, with a minimum of 1 row deleted. </p>
  
  <p>So for instance if there are 20 values for user 2 log 2 pass 123 I want to delete the first and last 4 rows. If there are only 3 values for the ID variable I want to delete the first and last row. </p>
  
  <p>The resulting dataset would be:</p>
  
  <pre><code>user   Log Pass  Value
  2       2   123     543
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     543
  4       3   125     231
  4       3   125     257
  4       3   125     543
  4       3   125     231
  </code></pre>
  
  <p>I've tried fiddling around with nrow but I struggle to figure out how to reference the % of rows by id variable. </p>
  
  <p>Thanks. </p>
  
  <p>Jonathan. </p>