title: Extract certain number of rows in dataframe based on condition in R?
body: <p>Let's say I have a dataframe</p>
  
  <pre><code>Group Pos Score
  A     V   82
  A     V   72
  A     W   95
  A     W   92
  A     W   65
  A     W   61
  A     X   82
  A     X   80
  A     X   70
  B     V   88
  B     V   77
  B     W   95
  B     W   91
  B     W   85
  B     W   71
  B     X   88
  B     X   83
  B     X   78
  ...
  #this data frame has groups with values C, D, E, etc also
  </code></pre>
  
  <p>Let's say I want to keep the top number of scores for each <code>Group</code>, and each <code>Pos</code>. For example, let's say I want to keep the top 1 <code>Score</code> for <code>Pos=V</code>, top 3 <code>Score</code>s for <code>Pos=W</code>, and top 2 <code>Score</code>s of <code>Pos=X</code></p>
  
  <p>So I want the dataframe to look like</p>
  
  <pre><code>Group Pos Score
  A     V   82
  A     W   95
  A     W   92
  A     W   65
  A     X   82
  A     X   80
  B     V   88
  B     W   95
  B     W   91
  B     W   85
  B     X   88
  B     X   83
  </code></pre>
  
  <p>How can I do this in R?</p>