title: R - Object not found error when using ddply
body: <p>I'm applying ddply to the following data frame. The point is to apply ecdf function to yearly_test_count value to rows that have the same country.</p>
  
  <pre><code>&gt; head(test)
   country yearly_test_count download_speed
  1      AU                 1       2.736704
  2      AU                 6       3.249486
  3      AU                 6       2.287267
  4      AU                 6       2.677241
  5      AU                 6       1.138213
  6      AU                 6       3.205364
  </code></pre>
  
  <p>This is the script I used:</p>
  
  <pre><code> house_total_year_ecdf &lt;- ddply(test, c("country"), mutate, 
          ecdf_val = ecdf(yearly_test_count)(yearly_test_count)*length(yearly_test_count))
  </code></pre>
  
  <p>But I received the following error:</p>
  
  <pre><code>Error in eval(substitute(expr), envir, enclos) : 
    object 'yearly_test_count' not found
  </code></pre>
  
  <p>==================================================================</p>
  
  <p>I tried using the function ecdf alone with yearly_test_count column and it works:</p>
  
  <pre><code>ecdf(test$yearly_test_count)(test$yearly_test_count)*length(test$yearly_test_count)
  </code></pre>
  
  <p>Anyone has any idea why this doesn't work when using ddply?</p>
  
  <p>This is weird since the script worked before, now I run the script again and encounter the mentioned error. I'm not sure if this issue is related to different in versions of R or versions of the package?</p>
  
  <p>Any help is much appreciated ! :)</p>