title: R reshape package: "Error in Dim(x)"... "dims [product 100] do not match the length of object [109]"
body: <p>I've got what I think is a relatively benign reshape going using the reshape package. I have "molten" data that looks like this: </p>
  
  <pre><code>&gt; head(meltDf)
      CITY       DATE       variable value
  1 Anqing 1953-01-01 DAILY_MAX_TEMP   9.1
  2 Anqing 1953-01-02 DAILY_MAX_TEMP   5.1
  3 Anqing 1953-01-03 DAILY_MAX_TEMP   5.2
  4 Anqing 1953-01-04 DAILY_MAX_TEMP   4.6
  5 Anqing 1953-01-05 DAILY_MAX_TEMP   7.9
  6 Anqing 1953-01-06 DAILY_MAX_TEMP   9.9
  &gt; str(meltDf)
  'data.frame':   100 obs. of  4 variables:
   $ CITY    : chr  "Anqing" "Anqing" "Anqing" "Anqing" ...
   $ DATE    : POSIXlt, format: "1953-01-01" "1953-01-02" "1953-01-03" "1953-01-04" ...
   $ variable: Factor w/ 1 level "DAILY_MAX_TEMP": 1 1 1 1 1 1 1 1 1 1 ...
   $ value   : num  9.1 5.1 5.2 4.6 7.9 9.9 8.1 13.3 17.6 17.6 ...
  </code></pre>
  
  <p>But when I try to cast() the data I get this error: </p>
  
  <pre><code>&gt; castDf &lt;- cast( meltDf , DATE + CITY ~ variable)
  Error in dim(X) &lt;- c(n, length(X)/n) : 
    dims [product 100] do not match the length of object [109]
  </code></pre>
  
  <p>Here's some example code that exactly reproduces the problem. In order to keep the question concise I put the data up on github:</p>
  
  <pre><code>require(RCurl)
  require(reshape)
  myFile &lt;- getURL("https://raw.github.com/gist/1010735/29ec65a48740ebe512f8af7a124e1e65e91ac054")
  temporaryFile &lt;- tempfile()
  con &lt;- file(temporaryFile, open = "w")
  cat(myFile, file = con) 
  close(con)
  meltDf &lt;- dget(temporaryFile)
  castDf &lt;- cast( meltDf , DATE + CITY ~ variable)
  </code></pre>
  
  <p>Any ideas what is causing the error? I thought this was a pretty straightforward reshape. </p>