Re: [R] help with reshaping wide to long format

2012-12-31 Thread usha2013
beseNormal) > # > #Deviance Residuals: > # Min 1Q Median 3Q Max > #-0.8630 -0.5452 -0.5452 -0.4965 2.0759 > > #Coefficients: > # Estimate Std. Error z value Pr(>|z|) > #(Intercept) -1.830990.05768 -31.745 <2e-16 *** >

Re: [R] help with reshaping wide to long format

2012-12-31 Thread arun
I can't say whether nlme or lme4 is better in this case.  You could fit the model with several other variables and select the best model based on different criteria. Happy New Year! A.K.   From: Usha Gurunathan To: arun Sent: Sunday, December 30, 2012

Re: [R] help with reshaping wide to long format

2012-12-30 Thread arun
es:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 For your question, I guess you need to add interaction term also in the model.  I am not sure whether you need random effects in the model.  If that is the case, you need ?lmer() from library(lme4). You could also post the question in R

Re: [R] help with reshaping wide to long format

2012-12-28 Thread arun
tp://www.r-project.org/posting-guide.html) and "An introduction to R" (the link will be in the posting guide). A.K. - Original Message - From: usha2013 To: r-help@r-project.org Cc: Sent: Friday, December 28, 2012 2:02 AM Subject: Re: [R] help with reshaping wide to long format

Re: [R] Help with Reshaping from Wide to Long

2010-07-20 Thread Kingsford Jones
On Sun, Jul 18, 2010 at 6:44 PM, jlwoodard wrote: > > Hi Phil and Jeff, >    Thanks so much for taking the time to help me solve this issue!  Both > approaches work perfectly.  Each of your approaches helped me learn more > about what R can do.   I really appreciate your help! Hi John, Now that

Re: [R] Help with Reshaping from Wide to Long

2010-07-18 Thread jlwoodard
Hi Phil and Jeff, Thanks so much for taking the time to help me solve this issue! Both approaches work perfectly. Each of your approaches helped me learn more about what R can do. I really appreciate your help! Very best regards, John -- View this message in context: http://r.789695.n4

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread Phil Spector
An alternative using the base reshape function: one = reshape(accuracy,idvar='Subject',varying=list(c(2,3,4),c(5,6,7),c(8,9,10)), direction='long',timevar='shape') two = reshape(one,idvar=c('Subject','shape'),varying=list(3:5), direction='long',timevar='color') two$sh

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread Jeff Newmiller
Try this: library(reshape) accuracy <- structure(list(Subject = c(101L, 102L, 103L, 104L, 105L, 106L ), CircleBlue = c(95L, 80L, 80L, 85L, 70L, 70L), CircleRed = c(100L, 90L, 70L, 80L, 75L, 75L), CircleGreen = c(100L, 100L, 95L, 100L, 95L, 75L), SquareBlue = c(95L, 85L, 90L, 90L, 70L, 40L), Squa

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread John L. Woodard
Hi Tal, Here is the output as you requested: structure(list(Subject = c(101L, 102L, 103L, 104L, 105L, 106L ), CircleBlue = c(95L, 80L, 80L, 85L, 70L, 70L), CircleRed = c(100L, 90L, 70L, 80L, 75L, 75L), CircleGreen = c(100L, 100L, 95L, 100L, 95L, 75L), SquareBlue = c(95L, 85L, 90L, 90L, 70L, 40L),

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread Tal Galili
Hi John, Try posting a sample of your data in reply to this e-mail by using: dput(head(accuracy)) And me (or someone else) will be sure to fix your command. Regarding the ANOVA, read more :) Tal Contact Details:--- Contact

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread jlwoodard
Tal, Thanks for the information. I actually did read through the help for the reshape package, though being relatively new to R, I don't quite understand the ins and outs of the command. I tried using the melt command: x<-melt(accuracy,id='Subject') but, it didn't give me anything different

Re: [R] Help with Reshaping from Wide to Long

2010-07-17 Thread Tal Galili
Hi John, 1) Read the help for the "reshape" package. What you want is to use the "melt" function. 2) There are various ways of doing Repeated measures Anova in R, you might want to have a look at this: http://www.r-statistics.com/2010/04/repeated-measures-anova-with-r-tutorials/ (I especially lik

[R] Help with Reshaping from Wide to Long

2010-07-17 Thread jlwoodard
I am trying to reshape data that are in the wide format into the long format. The design is a repeated-measures design, which combined 3 levels of shape (circle, square, triangle) with 3 levels of color (Blue, Red, Green), for a total of 9 variables. The wide data look like this (sorry I couldn'

Re: [R] Help with reshaping data.frame

2009-08-04 Thread davidr
l.com] Sent: Monday, August 03, 2009 4:57 PM To: David Reiner Cc: R-help@r-project.org Subject: Re: [R] Help with reshaping data.frame On Mon, Aug 3, 2009 at 5:23 PM, wrote: > I'm having trouble reshaping a data.frame from long to wide. > (I think that's the right terminology; fe

Re: [R] Help with reshaping data.frame

2009-08-03 Thread Gabor Grothendieck
Try this: > tst2 <- tst[-(2:3)] > tst2$timevar <- with(tst, interaction(K2, K3)) > reshape(tst2, dir = "wide", idvar = "K1", timevar = "timevar") K1 V1.D.a V2.D.a V3.D.a V1.E.a V2.E.a V3.E.a V1.D.b V2.D.b V3.D.b V1.E.b V2.E.b V3.E.b 1 10 0.08 99105 NA NA NA NA 76

Re: [R] Help with reshaping data.frame

2009-08-03 Thread hadley wickham
On Mon, Aug 3, 2009 at 5:23 PM, wrote: > I'm having trouble reshaping a data.frame from long to wide. > (I think that's the right terminology; feel free to educate me.) > I've looked at the reshape function and package and plyr package, > but I can't quite figure out how to do this after a dozen v

Re: [R] Help with reshaping data.frame

2009-08-03 Thread rmailbox
51680 NA 38323 0.07 20364 > Eric - Original message - From: dav...@rhotrading.com To: R-help@r-project.org Date: Mon, 3 Aug 2009 16:23:22 -0500 Subject: [R] Help with reshaping data.frame I'm having trouble reshaping a data.frame from long to wide. (I think

[R] Help with reshaping data.frame

2009-08-03 Thread davidr
I'm having trouble reshaping a data.frame from long to wide. (I think that's the right terminology; feel free to educate me.) I've looked at the reshape function and package and plyr package, but I can't quite figure out how to do this after a dozen variations. I have a data.frame with more level

[R] help with reshaping (no file attached)

2009-02-13 Thread Amit Patel
MCI A1 A2 A13 A14 A23 A24 A33 A34 Grouped together 56766 N/A N/A N/A N/A N/A N/A N/A N/A N/A 6459 N/A N

[R] help with reshaping

2009-02-13 Thread Amit Patel
hi Im having some problems reshaping Ive managed to apply it but have some problems the attached document will explain any help is appreciated __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the po

Re: [R] help with reshaping data into long format (correct question)

2008-01-16 Thread Henrique Dallazuanna
try this: x[6, which(x[5,]=="y")] <- "y" levels(x$id) <- c(levels(x$id)[drop=T], "treat") x <- x[-5,] x[5, "id"] <- "treat" levels(x$id) <- gsub("^ques", "", levels(x$id)) x3 <- as.data.frame(t(x[,-1])) names(x3) <- x$id foo <- function(x, ...) { tmp <- as.numeric(as.character(unlist(x[,grep("_",

[R] help with reshaping data into long format (correct question)

2008-01-15 Thread Tom Cohen
Dear list, I have the following data set id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treat_a y y yy treat_b n n