title: How to pass a symbolic variable name between nested functions in the dplyr-way?
body: <p>I want to write a function, which takes symbolic names of columns and pass it to subsequent functions doing something specific (sub-tasks).</p>
  <p>Let me show you an example:</p>
  <p>The data:</p>
  <pre><code>&gt; ( d &lt;- data.frame(A=1:3, B=3:1) )
    A B
  1 1 3
  2 2 2
  3 3 1
  </code></pre>
  <p>Now my function:</p>
  <pre><code>fn &lt;- function(data, cols) {
    return(data %&gt;% mutate(across({{cols}}, ~. * 2)))
  }
  </code></pre>
  <p>It works:</p>
  <pre><code>&gt; d %&gt;% fn(A)
    A B
  1 2 3
  2 4 2
  3 6 1
  </code></pre>
  <p>Now, suppose this function does something important and separable as a unit task. Now I want to use this function in another function, taking column names in the dplyr-way:</p>
  <pre><code>another_fn &lt;- function(data, cols) {
    result &lt;- data %&gt;% fn(cols)
    # .... more code
    
    return(result)
  }
  </code></pre>
  <p>This doesn't work.</p>
  <pre><code>&gt; d %&gt;% another_fn(cols = A)
  Error: Problem with `mutate()` input `..1`.
  x object 'A' not found
  i Input `..1` is `across(cols, ~. * 2)`.
  Run `rlang::last_error()` to see where the error occurred.
  </code></pre>
  <p>When I provide the column as a string, it works well. So I understand  the context is lost somewhere when I provide just the symbolic name A</p>
  <pre><code>&gt; d %&gt;% another_fn(cols = &quot;A&quot;)
  Note: Using an external vector in selections is ambiguous.
  i Use `all_of(cols)` instead of `cols` to silence this message.
  i See &lt;https://tidyselect.r-lib.org/reference/faq-external-vector.html&gt;.
  This message is displayed once per session.
    A B
  1 2 3
  2 4 2
  3 6 1
  </code></pre>
  <p>My question is: how to pass the symbolic name across nested calls?</p>
  <p>Please note, <strong>I DO NOT WANT using three-dot (ellipsis) operator</strong>. I DO WANT to control what I pass and to which variable.</p>
  <hr />
  <p>EDIT:</p>
  <p>OK, I found the answer.  The {{ }} should be added in the nested calls</p>
  <pre><code>another_fn &lt;- function(data, cols) {
    result &lt;- data %&gt;% fn({{cols}})
    # .... more code
    
    return(result)
  }
  
  
  &gt; d %&gt;% another_fn(cols = A)
    A B
  1 2 3
  2 4 2
  3 6 1
  &gt; d %&gt;% another_fn(cols = &quot;A&quot;)
    A B
  1 2 3
  2 4 2
  3 6 1
  &gt; column
  [1] &quot;A&quot;
  &gt; d %&gt;% another_fn(cols = column)
    A B
  1 2 3
  2 4 2
  3 6 1
  &gt; 
  </code></pre>