title: cast function results arguments imply differing number of rows: 9, 0
body: <p>I am trying to find the mean for each variable uniquely but I don't know why it's giving error after applying cast function.</p>
  
  <pre><code> library(reshape)
  &gt; odata &lt;- read.csv("dummy2.csv")
  &gt; msdata &lt;- melt(odata, id=c("A","F"))
  &gt; subjmeans &lt;- cast(msdata, A~ variable, mean)
  </code></pre>
  
  <blockquote>
    <p>Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  :<br>
        arguments imply differing number of rows: 9, 0</p>
  </blockquote>
  
  <p>Here is the data I have used.</p>
  
  <pre><code>            Timestamp    A              B    C   D    E     F    G           H            I         J 
              2586    01_Antwerpen_S1.jpg 9   250 1151 458    p1  color   261.8472837 13.27605282 50.20731621
              2836    01_Antwerpen_S1.jpg 10  150 1371 316    p1  color   41.01219331 2.088502575 25.59470566
              2986    01_Antwerpen_S1.jpg 11  283 1342 287    p1  color   580.2206477 28.92031693 84.62469724
              3269    01_Antwerpen_S1.jpg 12  433 762  303    p1  color   138.1303732 7.026104125 36.45742907
              3702    01_Antwerpen_S1.jpg 13  183 624  297    p1  color   88.20430828 4.489909458 30.87780081
              3885    01_Antwerpen_S1.jpg 14  333 712  303    p1  color   42.20189569 2.149072905 25.72796039
              4218    01_Antwerpen_S1.jpg 15  300 753  293    p1  color   51.7880295  2.637077062 26.80156954
              6517    01_Antwerpen_S1.jpg 22  333 601  674    p1  color   466.0525721 23.40488212 72.49074066
              9066    02_Berlin_S1.jpg    27  149 1067 681    p1  color   90.42676595 4.602920212 31.12642447
              9215    02_Berlin_S1.jpg    28  266 1116 757    p1  color   101.8430165 5.18328435  32.40322557
              9481    02_Berlin_S1.jpg    29  217 1020 723    p1  color   314.3962468 15.90906187 55.99993612
              9698    02_Berlin_S1.jpg    30  183 711  781    p1  color   272.045952  13.78825606 51.33416332
              9881    02_Berlin_S1.jpg    31  183 439  776    p1  color   249.9939999 12.68008164 48.8961796
              10064   02_Berlin_S1.jpg    32  167 328  552    p1  color   193.8375609 9.847751174 42.66505258
              10231   02_Berlin_S1.jpg    33  400 310  359    p1  color   68.00735254 3.462531847 28.61757006
              10631   02_Berlin_S1.jpg    34  666 246  336    p1  color   93.40770846 4.754485399 31.45986788
              11297   02_Berlin_S1.jpg    35  333 172  279    p1  color   1105.224412 52.32154317 136.107395
              13679   03_Bordeaux_S1.jpg  40  316 1152 790    p1  color   280.8629559 14.23062355 52.30737182
              13995   03_Bordeaux_S1.jpg  41  583 1424 860    p1  color   134.1827113 6.825784964 36.01672692
              14578   03_Bordeaux_S1.jpg  42  283 1486 979    p1  color   133.9589489 6.814429158 35.99174415
              14861   03_Bordeaux_S1.jpg  43  233 1419 863    p1  color   282.1772493 14.29652823 52.4523621
              15094   03_Bordeaux_S1.jpg  44  266 1149 781    p1  color   998.5128943 47.86171758 126.2957787
              17559   04_Köln_S1.jpg      49  200 151  813    p1  color   590.041524  29.38880547 85.65537204
              17759   04_Köln_S1.jpg      50  183 741  806    p1  color   294.9779653 14.93791111 53.86340444
              17943   04_Köln_S1.jpg      51  216 1035 782    p1  color   81.0246876  4.124771083 30.07449638
              18159   04_Köln_S1.jpg      52  117 1068 708    p1  color   85.80209788 4.367748556 30.60904682
  </code></pre>
  
  <p>Result is same and error is same with IRIS Data too.</p>
  
  <pre><code>library(reshape)
   ss &lt;- iris
   msdata &lt;- melt(ss, id=c("Sepal.Length","Species"))
   subjmeans &lt;- cast(msdata, Species~ variable, mean)
  </code></pre>
  
  <p>Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
    arguments imply differing number of rows: 9, 0</p>