Function call in R with named parameters - the name is in a variable instead of writing it directly in the function call
<p>Suppose I have this function:</p>

<pre><code>f &lt;- function(a = 0, b = 1) {
    ...
}
</code></pre>

<p>I want to call this function and specify only parameter <strong>b</strong>:</p>

<pre><code>f(b = 2);
</code></pre>

<p>However, instead of writing <strong>b</strong> directly above, I would like, if possible, to have the parameter name in a variable:</p>

<pre><code>temp = "b";
f(temp = 2);
</code></pre>

<p>The above attempt obviously does not work in R. Any way to do this? Thanks!</p>