Non-standard evaluation for setting one input based on the value of another
<p>Can non-standard evaluation be used to accomplish the following?</p>

<pre><code>rnorm( 10, mean = 2, sd = mean/2 )
</code></pre>

<p>This pseudocode intends to set <code>sd</code>  to half of <code>mean</code>. Is there a way to set an input based on the values of other inputs to its left?</p>

<p>Hadley Wickham has a chapter in <a href="http://adv-r.had.co.nz/Computing-on-the-language.html" rel="nofollow">Advanced R</a>
 about NSE, but I haven't found a similar principle there or on SO. A negative answer would also be helpful.</p>

<p>I've found one example of a function that does something similar within the <code>dplyr</code> package: </p>

<pre><code>mutate(my_df, x = a + b, y = x + c)
</code></pre>

<p>A new variable <code>x</code> is defined as the sum of existing variables <code>a</code> and <code>b</code>. Then, a new variable <code>y</code> is defined as the sum of the newly created <code>x</code> and an already existing <code>c</code>.</p>