title: How to correctly pass args to ggplot stat_function
body: <p>I have tried to fix this problem a number of ways, but I am new to R, so I don't know the tips and tricks. I am trying to graph a polynomial function using code for a quadratic function, provided by my teacher, however, I keep running into the "unused arguments error". the issue is that I have given three arguments, which is what the function expects. this is the code I entered:</p>
  
  <pre><code>&gt; quadratic &lt;- function(x, u.values){
  + X &lt;- cbind(1, x, x^2)
  + return(X %*% u.values)
  + }
  &gt; dev.new()
  &gt; ggplot() +
  + geom_point(aes(x = t,y = y),data= GData)+
  + stat_function(fun=quadratic(args=c(1.9604816, -0.1201548, -4.9768049)))
  Error in quadratic(args = c(1.9604816, -0.1201548, -4.9768049)) : 
    unused argument(s) (args = c(1.9604816, -0.1201548, -4.9768049))
  </code></pre>