title: R- Summarize multiple values from custom function with ddply
body: <p>Is there a way to use <code>ddply</code> with a function that returns multiple values and combine these values in separate columns of a dataframe? I created a fictious example to illustrate what I mean. </p>
  
  <pre><code>#random data
  ID &lt;- rep(paste0("ID", 1:10), each=10)
  x &lt;- c(1:10)
  y &lt;- x+rnorm(100)
  df&lt;-data.frame(ID=ID, x=x,y=y)
  
  #function that returns two values
  myfunc &lt;- function(y=y, x=x){
    m &lt;- summary(lm(y~x))
    c1&lt;-m$fstat[1]
    c2&lt;-m$coefficients[1]
    c(c1,c2)
   }
  
   ddply(df, .(ID), summarize, myfunc(y=y,x=x))
  </code></pre>
  
  <p>Currently, the output looks like this:</p>
  
  <pre><code>     ID           ..1
  1   ID1  69.477838332
  2   ID1  -0.279584776
  3  ID10 396.792689197
  4  ID10  -0.359578656
  </code></pre>
  
  <p>What I would like to get is this:</p>
  
  <pre><code>     ID            c1            c2
  1   ID1  69.477838332  -0.279584776
  2  ID10 396.792689197  -0.359578656
  </code></pre>
  
  <p>I know I could change the output from ddply to get the desired result, but I'm wondering if there's anything I can change in my function or in the ddply call that would give the desired output. 
  Thank you for your help!</p>