title: "dims [product 0] do not match the length of object" error in R when using daply for frequency counts
body: <p>I have a list of data.frames that looks like this:</p>
  
  <pre><code>df=data.frame(
  data_id=rep(LETTERS[1:10],each=1),
  data_value=c(1,2,2,3,3,2,3,1,1,3))
  df2=data.frame(
  data_id=rep(LETTERS[1:10],each=1),
  data_value=c(2,1,3,1,1,1,2,1,2,1))
  df3=data.frame(
  data_id=rep(LETTERS[1:10],each=1),
  data_value=c(2,2,3,3,1,2,2,1,2,3))
  df.list &lt;- list(df, df2, df3)
  </code></pre>
  
  <p>A single data.frame looks like this: </p>
  
  <pre><code>         data_id    data_value
  1        A          1
  2        B          2
  3        C          2
  4        D          3
  5        E          3
  6        F          2
  7        G          3
  8        H          1
  9        I          1
  10       J          3
  </code></pre>
  
  <p>I want to have a frequency count of how often each unique value appears in data_value. I can do this:</p>
  
  <pre><code>for(i in 1:length(df.list)){
      daply(df.list[[i]], .(df.list[[i]]$data_value), nrow) -&gt; freq
  }
  </code></pre>
  
  <p>Which gives me the frequency count (in this case just the last one, for df3):</p>
  
  <pre><code>1 2 3 
  2 5 3 
  </code></pre>
  
  <p>My actual dataset is far bigger so I cannot post it here. It has the exact same structure, however. The problem is that when I try to get the frequency counts for my actual dataset, I get the following error message: </p>
  
  <pre><code>Error in dim(out_array) &lt;- out_dim : dims [product 0] do not match the length of object [1]
  </code></pre>
  
  <p>Can anyone tell me where I need to start looking to fix this? I don't understand where 'dim()' comes in and what it does. Many thanks.</p>