arrange_() multiple columns with descending order
<p>I am trying to use <code>arrange_()</code> with string input and in one of the columns in descending order.</p>

<pre><code>library(dplyr) # R version 3.3.0 (2016-05-03) , dplyr_0.4.3 
# data
set.seed(1)
df1 &lt;- data.frame(grp = factor(c(1,2,1,2,1)),
                  x = round(runif(5,1,10), 2))

#   grp    x
# 1   1 3.39
# 2   2 4.35
# 3   1 6.16
# 4   2 9.17
# 5   1 2.82
</code></pre>

<p>Below is what I need to achieve:</p>

<pre><code>df1 %&gt;% arrange(grp, -x)
df1 %&gt;% arrange(grp, desc(x))
#   grp    x
# 1   1 6.16
# 2   1 3.39
# 3   1 2.82
# 4   2 9.17
# 5   2 4.35
</code></pre>

<p>In my case second column is a string:</p>

<pre><code>#dynamic string
myCol &lt;- "x"

#failed attempts
df1 %&gt;% arrange_("grp", desc(myCol))
</code></pre>

<blockquote>
  <p>Error: incorrect size (1), expecting : 5</p>
</blockquote>

<pre><code>df1 %&gt;% arrange_("grp", "desc(myCol)")
</code></pre>

<blockquote>
  <p>Error: object 'myCol' not found</p>
</blockquote>

<pre><code>df1 %&gt;% arrange_(c("grp", "desc(myCol)"))
#wrong output
#   grp    x
# 1   1 3.39
# 2   1 6.16
# 3   1 2.82
# 4   2 4.35
# 5   2 9.17
</code></pre>

<p>I found similar solution <a href="https://stackoverflow.com/questions/26497751">here</a>, but couldn't make it work:</p>

<pre><code>df1 %&gt;% arrange_(.dots = c("grp", "desc(myCol)"))
</code></pre>

<blockquote>
  <p>Error: object 'myCol' not found</p>
</blockquote>

<p>Feels like I am missing something very obvious, ideas?</p>