title: Ddply and summary of categorical variables
body: <p>I have a dataframe x like this</p>
  
  <pre><code>Id   Group   Var1
  001    A     yes
  002    A     no
  003    A     yes
  004    B     no
  005    B     yes
  006    C     no
  </code></pre>
  
  <p>I want to create a data frame like this</p>
  
  <pre><code>Group    yes    no
  A        2      1
  B        1      1
  C        0      1
  </code></pre>
  
  <p>The function .aggregate works well</p>
  
  <pre><code>aggregate(x$Var1 ~ x$Group,FUN=summary)
  </code></pre>
  
  <p>but I am not able to create a dataframe with the results.</p>
  
  <p>If I try using .ddply </p>
  
  <pre><code>ddply(x,"Group",function(x) summary(x$Var1))
  </code></pre>
  
  <p>I obtain the error: Results do not have equal lengths.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks.</p>