replace negative values with NA for all columns?
<p>Suppose my data looks something like this (with many more columns)</p>

<pre><code>set.seed(112116)
df &lt;- data.frame(x1 = sample(c(LETTERS, -1:-10), 100, replace = T),
                 x2 = sample(c(letters, -1:-10), 100, replace = T),
                 x3 = sample(c(1:30, -1:-10), 100, replace = T))
</code></pre>

<p>I want to replace all negative numbers with NA. I can do it one by one like this:</p>

<pre><code>df &lt;- df %&gt;% mutate(x1 = replace(x1, which(x1&lt;0), NA),
              x2 = replace(x2, which(x2&lt;0), NA),
              x3 = replace(x3, which(x3&lt;0), NA))
</code></pre>

<p>But i'm hoping that there is a way of doing this for all columns in my data</p>