title: Identifying vectors with 5 highest and 5 lowest values for a particular row in the df
body: <p>I have a data frame as shown below:</p>
  
  <pre><code>    group     respondent nteachers totalq3 totalq4 totalq5 totalq6 totalq7
  1       2            You         2       5       4       4       5       5
  2       2  Your Teachers         2      10       8       9      10      10
  119  1001 All Principals        NA      NA      NA      NA      NA      NA
  120  1002   All Teachers        NA      NA      NA      NA      NA      NA
  </code></pre>
  
  <p>There are additional vectors that go beyond totalq7 (through totalq53) but this snippet of data should suffice.</p>
  
  <p>What I need is some way of identifying vectors totalq3 through totalq53 in descending order of the values for "Your Teachers". Then I flag the 5 vectors with the highest values for "Your Teachers" and output these 5 to xtable. Finally the process has to be repeated to identify the 5 vectors with the smallest values for "Your Teachers". </p>
  
  <p>What is the trick here? Any and all tips would be much appreciated.</p>
  
  <p>Ani</p>