[R] reshape2: Lost Values Between melt() and dcast()

Rich Shepard rshepard at appl-ecosys.com
Mon Oct 31 19:42:28 CET 2011


On Mon, 31 Oct 2011, Justin Haynes wrote:

> I'd look at the outputs of those two dcast calls and find cells where the
> length is > 1.  Those are duplicated entries in your initial data.frames
> (when I've run into this is was usually due to NA values somewhere
> unexpected).

   The dcast() resulting data frame has one row with a '2' in one column.
However the melt() data frame has only one row with that combination of
site, sampdate, and param. The problem is that the melt(), and the chemdata
data frames show the quant value as 'NA' while the original database table
has the value of 1.0 for that site, sampdate, and param. I'll re-read the
table and see if that fixes the issue with this one subset data frame.

   Curious how the database table has a value of 1.00 mg/L and the read data
frame contains NA. More curious is why the cast() data frame has a '2' for
that row.

Rich



More information about the R-help mailing list