title: Passing a function argument to ddply
body: <p>I know there are various similar questions out there and as such I aplogize for the repetition. That said, while I have found useful information on this topic, nothing I've attempted seems to work. </p>
  
  <p>In short, I'm using ddply inside a function, and attempting to pass an argument from the function to a function in ddply. </p>
  
  <p>A simplified example using the <code>iris</code> dataset</p>
  
  <pre><code>IG_test &lt;-function(data, feature){
    dd&lt;-ddply(data, feature, here(summarise), N=length(feature))
    return(dd)
  }
  
  IG_test(iris, "Species")
  </code></pre>
  
  <p>This should return the number of records for every Species, but rather returns 1 in each case. </p>
  
  <p>If I specify "Species" directly in <code>length()</code>, I get what I'm looking for</p>
  
  <pre><code>IG_test &lt;-function(data, feature){
    dd&lt;-ddply(data, feature, here(summarise), N=length(Species))
    return(dd)
  }
  
      IG_test(iris, "Species")
  
       Species  N
  1     setosa 50
  2 versicolor 50
  3  virginica 50
  </code></pre>
  
  <p>The most recent questions describing similar problems suggest using <code>here()</code> for the <code>summarize()</code> function in ddply, in order to tell ddply where to look for the variable. this works insomuch as <code>feature</code> is found (without <code>here()</code> we get an error), however it doesn't return the length as expected. </p>
  
  <p>Any ideas?</p>