title: dplyr arrange data frame based on column position with new R pipe |>
body: <p>I want to sort my data frame based on a column that I pass to dplyr's <code>arrange</code> function with its position. This works as long as I'm using the &quot;old&quot; tidyverse/magrittr pipe operator. However, changing it to the new R pipe returns an error:</p>
  <pre><code>df &lt;- data.frame(x = c(3, 4, 1, 5),
                   y = 1:4)
  
  # Works
  df %&gt;% 
    arrange(.[1])
  
    x y
  1 1 3
  2 3 1
  3 4 2
  4 5 4
  </code></pre>
  <br />
  <pre><code># Throws error
  df |&gt; 
    arrange(.[1])
  
  Error:
  ! arrange() failed at implicit mutate() step. 
  Problem with `mutate()` column `..1`.
  i `..1 = .[1]`.
  x object '.' not found
  Run `rlang::last_error()` to see where the error occurred.
  </code></pre>
  <p>How can I still arrange by column position when using the new R pipe?</p>
  <p>I realize that the |&gt; operator does not accept the &quot;.&quot; as an argument, but I still don't know how else I could address the data then.</p>
  <p>Update:</p>
  <p>This seems to work, but wondering if there is something more straightforward:</p>
  <pre><code>df |&gt; 
    arrange(cur_data() |&gt; select(1))
  </code></pre>