title: dplyr's mutate_each within function works but matches() does not find argument
body: <p>When trying to solve <a href="https://stackoverflow.com/questions/28964929/r-how-to-apply-the-same-transformation-to-groups-of-variables-in-a-data-frame">this problem</a> I encountered a problem with <code>mutate_each</code> of <code>dplyr</code>. I wanted to use it within a function and pass arguments to it. It was successful for <code>funs()</code> but not for <code>matches()</code>.</p>
  
  <p>Let me show a simple example where the task is to append some tag the values of some variables.</p>
  
  <pre class="lang-r prettyprint-override"><code>library(dplyr) 
  mydf &lt;- data.frame(this_var1 = c("a", "b", "c", "d", "e"), 
                     this_var2 = c("b", "c", "d", "e", "f"),
                     that_var1 = c("x", "y", "z", "w", "u"))
  
  mymutate1 &lt;- function(data, tag) {
    data %&gt;% mutate_each(funs(paste0(., tag)))
  }
  
  mymutate1(mydf, "_foo")
    this_var1 this_var2 that_var1
  1     a_foo     b_foo     x_foo
  2     b_foo     c_foo     y_foo
  3     c_foo     d_foo     z_foo
  4     d_foo     e_foo     w_foo
  5     e_foo     f_foo     u_foo    
  </code></pre>
  
  <p>This works like a charm. However, if I try to control also for which variables the transformation should be applied it fails.</p>
  
  <pre class="lang-r prettyprint-override"><code>mymutate2 &lt;- function(data, tag, m) {
    data %&gt;% mutate_each(funs(paste0(., tag)), matches(m))
  }
  mymutate2(mydf, "_foo", "this")
  </code></pre>
  
  <p>This gives the following error: <code>Error in is.string(match) : object 'm' not found</code>. Why is <code>tag</code> found whereas <code>m</code> not? </p>
  
  <p>The code itself works as intended:</p>
  
  <pre class="lang-r prettyprint-override"><code>mydf %&gt;% mutate_each(funs(paste0(., "_foo")), matches("this"))
    this_var1 this_var2 that_var1
  1     a_foo     b_foo         x
  2     b_foo     c_foo         y
  3     c_foo     d_foo         z
  4     d_foo     e_foo         w
  5     e_foo     f_foo         u
  </code></pre>