Subset by highest value of a variable (R) : <p>How can I create a subset by the highest value of a certain variable in a data frame?</p>

<p>I have the following dataframe, from which I want to extract the highest value of V1 by name:</p>

<pre><code>   name V1 V2
1 name1  1  f
2 name1  2  b
3 name1  5  c
4 name2  3  f
5 name2  8  g
6 name2  2  m
</code></pre>

<p>The subset should look like this</p>

<pre><code>   name V1 V2
3 name1  5  c
5 name2  8  g
</code></pre>
