How to assign a point label conditionally in ggplot2 scatterplot in R?
<p>When I assign the points in my <code>ggplot</code> scatterplot a label like this, it works perfectly.</p>

<pre><code>geom_text(aes(label=df[,c("name")])))    
</code></pre>

<p>The problem is, however, that I aim to label only the "outstanding" dots, which happen to be those that have a <code>mycount</code> higher that say <code>500</code>. When I try to do this using the following snippet, the correct points are selected/labelled, but with a number (most probably the row index) instead of the <code>name</code>. </p>

<pre><code>geom_text(aes(label=ifelse(df[,c("mycount")]&gt;500,df[,c("name")],NA)))
</code></pre>

<p>Why does this not work and how should I modify the line so that points with a <code>mycount &gt; 500</code> get labelled with their <code>name</code>?</p>