[R] Syntax Check: rshape2 melt()

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Oct 27 20:07:01 CEST 2011


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rich Shepard
> Sent: Thursday, October 27, 2011 10:56 AM
> To: r-help at r-project.org
> Subject: Re: [R] Syntax Check: rshape2 melt()
> 
> On Thu, 27 Oct 2011, Nordlund, Dan (DSHS/RDA) wrote:
> 
> > I should apologize.  I saw rshape2 and just "glossed" over that and
> read
> > rshape.
> 
> Dan,
> 
>    Apparently the 'e' in the subject line fell off. It's 'reshape2'.
> 
> > So I was using the rshape package rather than rshape2.  I don't know
> the
> > relationship between those two packages and/or how they differ.  I am
> sure
> > that there are others that can help you out here.
> 
>    I, too, don't know how the two packages 'reshape, The Orignal' and
> 'reshape2, Rebooted' differ. The two articles by Hadley that I read
> ("Statistical Computing and Graphics", 2005, and "Journal of
> Statistical
> Software", 2007) do not explicitly specify which version of reshape is
> addressed.
> 
> Rich

Rich,

You should be able to get what you want using the dcast function (I think).

test.melted <- melt(tds.anal)
dcast(test.melted, site + sampdate ~ param)


Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204




More information about the R-help mailing list