title: How to get function to work where dplyr is being used?
body: <p>I get an error when trying to call my function where dplyr is used inside the function. Does dplyr not work inside R functions?</p>
  
  <pre><code>all_df_yoy &lt;- function(all_df, units) {
    all_df_yoy &lt;- all_df %&gt;% mutate(
      players_units_yoy = units)
  }
  
  us_players_all_df_yoy &lt;- all_df_yoy(us_players_all_df, players_units_us)
  </code></pre>
  
  <p>I get the following error.</p>
  
  <pre><code>Error in compat_lazy_dots(.dots, caller_env(), ..., .named = TRUE) : 
    object 'players_units_us' not found 
  </code></pre>
  
  <p>However, players_units_us does indeed exist inside the data frame​.</p>