Syntax Check: rshape2 melt()
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