On Mar 6, 2012, at 3:00 PM, David Perlman wrote:
I have a data frame in wide format. There are six variables that
represent two factors in long format 3x2, Valence and Temperature:
head(dpts)
File Subj Time Group PainNeg.hot PainNeg.warm
SociNeg.hot SociNeg.warm Positiv.hot
Thanks for your help on this Hadley and David!
Dennis Murphy also had a good solution (changing list(data.out2[-1])...etc
to names(data.out2[-1]}...):
data.out3 - reshape(data.out2, direction = 'long', varying =
names(data.out2[-1]),
+ idvar = 'id')
data.out4 - split(data.out3,
On Nov 24, 2009, at 8:33 PM, AC Del Re wrote:
Hi All,
I am wanting to convert a data.frame from a wide format to a long
format
(with 1 variable) and am having difficulties. Any help is
appreciated!
#current wide format
head(data.out2)
id rater.1 n.1 rater.2 n.2 rater.3 n.3
I don't really understand what you want and the example solution throws away
quite a lot of data, so consider this alternative:
data.out2 - read.table(textConnection(id rater.1 n.1 rater.2 n.2
rater.3 n.3 rater.4 n.4
11 11 0.118 79 NA NA NA NA NA NA
114
, November 24, 2009 6:43 PM
To: AC Del Re
Cc: r-help@r-project.org
Subject: Re: [R] reshape question
On Nov 24, 2009, at 8:33 PM, AC Del Re wrote:
Hi All,
I am wanting to convert a data.frame from a wide format to a long
format
(with 1 variable) and am having difficulties. Any help
Thank you for you reply. I will try this. The inital few rows in the .dat file
look like:
Year,DayOfYear,Sku,Quantity,CatId,Category,SubCategory
2009,1,100051,1,10113,MEN,Historical men's
2009,1,100130,1,10638,ACCESSORIES MAKEUP,ALL Kids Accessories
2009,1,100916,1,10222,WOMEN,TV Movies Women
solution:
reshape package, melt function.
On Tue, 2008-11-18 at 02:07 +, Alexandre Swarowsky wrote:
Hi,
It's probably a simple issue but I'm struggling with that. I'll use the
example shown in the help page.
head(Indometh)
wide - reshape(Indometh, v.names=conc, idvar=Subject,
On 2/8/2008 9:15 AM, Ista Zahn wrote:
I know there are a lot of reshape questions on the mailing list, but I
haven't been able to find an answer to this particular issue.
I am trying to get a datafame structured like this:
sub - rep(1:5)
ta1 - rep(1,5)
ta2 - rep(2,5)
tb1-
8 matches
Mail list logo