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'