title: Use ggplot2 to plot multiple curves
body: <p>Say I have a data frame <code>coefs</code> where each row contains model coefficients for a curve. </p>
  
  <pre><code>coefs &lt;- structure(list(a1 = c(1.22228259789383, 1.2064168157394, 1.09555089661994, 0.943947433470916, 0.883490658557721, 0.46125552320107), d = c(0.385227755933488, 0.457271644919152, 0.340063262461958, 0.305629949064525, 0.42459163183877, 0.425710112988664), g = c(0, 0, 0, 0, 0, 0), u = c(1, 1, 1, 1, 1, 1)), .Names = c("a1", "d", "g", "u"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -6L))
  </code></pre>
  
  <p>I'd like to use each row of the data frame to add a new curve to the plot based a defined function: (you may recognize it as a 2PL item response model)</p>
  
  <pre><code>TWOPL &lt;- function(x,a1,b) {
    1 / (1 + exp(-a1*(x-(b))))
  }
  </code></pre>
  
  <p>Based on <a href="https://stackoverflow.com/questions/5177846/equivalent-of-curve-for-ggplot">this</a> and <a href="https://stackoverflow.com/questions/5177846/equivalent-of-curve-for-ggplot">this</a> question I tried the following ggplot command but get the error that computation failed:</p>
  
  <pre><code>library(ggplot2)
  p &lt;- ggplot(coefs, aes(x = 0))
  p + stat_function(fun = TWOPL) + xlim(-5,5)
  </code></pre>
  
  <p>I know that I need a way to give the various coefficients to the function. As a test, I tried the function with a fixed parameters to create 1 curve and it works, for example:</p>
  
  <pre><code>#1 curve based on fixed parameters
  TWOPL_copy &lt;- function(x) {
    1 / (1 + exp(-1.22*(x-(.385))))
  }
  
  p &lt;- ggplot(data.frame(x = 0), aes(x = 0))
  p + stat_function(fun = TWOPL_copy) + xlim(-5,5)
  </code></pre>
  
  <p>I'm wondering how I might send each row of the data frame to ggplot. An ideal next step would be to differentiate the colors of each line somehow.</p>