Skip to content
Back to formatted view

Raw Message

Message-ID: <alpine.LNX.2.00.1110271145550.30779@salmo.appl-ecosys.com>
Date: 2011-10-27T18:48:58Z
From: Rich Shepard
Subject: Syntax Check: rshape2 melt()
In-Reply-To: <941871A13165C2418EC144ACB212BDB0021814CE@dshsmxoly1504g.dshs.wa.lcl>

On Thu, 27 Oct 2011, Nordlund, Dan (DSHS/RDA) wrote:

> What I think you want is as simple as
> test.melted <- melt(test)

Dan, et al.:

   No, it's not that simple. Unfortunately. I've tried various combinations
of id.vars, measure.vars, and variable, but just cannot get the dates to
display in the melted data frame. For example,

m.tds.anal <-  melt(tds.anal, id.vars = c('site', 'param'), measure.vars =
'sampdate', variable.name = 'variable', na.rm = T, value.name = 'quant')
> head(m.tds.anal)
      site param variable quant
1   UDS-O   TDS sampdate 13488
2  STC-FS  Cond sampdate  9661
3   UDS-O    Mg sampdate 13790
4   UDS-O   SO4 sampdate 13790
5 JCM-10B    Ca sampdate 13685
6 JCM-10B    Cl sampdate 13685

   No matter where I put 'sampdate' it displays as that string rather than as
the date itself.

Rich