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 like the "ezANOVA" function)
Cheers,
Tal
----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------
On Sat, Jul 17, 2010 at 6:42 PM, jlwoodard <john.woodard@wayne.edu> wrote:
>
> 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't
get
> the columns to line up quite right:
>
> Subject CircleBlue CircleRed CircleGreen SquareBlue SquareRed SquareGreen
> TriangleBlue TriangleRed TriangleGreen
> 1 101 95 100 100 95 100 100
> 60 80 75
> 2 102 80 90 100 85 90 100
> 55 45 45
>
> I would like to convert the data to the following format so that I could do
> a repeated measures ANOVA:
>
> Accuracy Subject Shape Color
> 95 subj101 Circle Blue
> 80 subj102 Circle Blue
> 100 subj101 Circle Red
> 90 subj102 Circle Red
> 100 subj101 Circle Green
> 100 subj102 Circle Green
> 95 subj101 Square Blue
> 85 subj102 Square Blue
> 100 subj101 Square Red
> 90 subj102 Square Red
> 100 subj101 Square Green
> 100 subj102 Square Green
> 60 subj101 Triangle Blue
> 55 subj102 Triangle Blue
> 80 subj101 Triangle Red
> 45 subj102 Triangle Red
> 75 subj101 Triangle Green
> 45 subj102 Triangle Green
>
> I've been able to accomplish the task using the stack command, together
> with
> some fairly lengthy code to reorganize the stacked data frame. Is it
> possible to use the reshape command to accomplish this task in a more
> straightforward manner? Many thanks in advance!
>
> John
>
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/Help-with-Reshaping-from-Wide-to-Long-tp2292462p2292462.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]