Re: [R] melting a list: basic question

From: hadley wickham <>
Date: Fri, 25 Jul 2008 20:50:25 -0500

On Fri, Jul 25, 2008 at 9:49 AM, baptiste auguie <> wrote:
> Dear list,
> I'm trying to use the reshape package to perform a merging operation on a
> list of data.frames as illustrated below,
>> a <- 1:10
>> example <- list( data.frame(a=a, b=sin(a)), data.frame(a=a, b=cos(a)) )
>> melt(example, id = a)

You want:

melt(example, id = "a")

i.e. the id argument is a character or numeric vector specifying which variables to use as id variables. Your call would be equivalent to

melt(example, id = 1:10)

which clearly is incorrect for your example.



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 26 Jul 2008 - 01:52:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 26 Jul 2008 - 02:32:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive