Skip to content
Back to formatted view

Raw Message

Message-ID: <4E8EDF98.2050103@bitwrit.com.au>
Date: 2011-10-07T11:16:40Z
From: Jim Lemon
Subject: Wide to long form conversion
In-Reply-To: <CAHmzXO6nVb-j4dNcprMaHK8Q=xuChF=VXEfF3naeveZQvrUtOw@mail.gmail.com>

On 10/07/2011 07:28 AM, Gang Chen wrote:
> I have some data 'myData' in wide form (attached at the end), and
> would like to convert it to long form. I wish to have five variables
> in the result:
>
> 1) Subj: factor
> 2) Group: between-subjects factor (2 levels: s / w)
> 3) Reference: within-subject factor (2 levels: Me / She)
> 4) F: within-subject factor (2 levels: F1 / F2)
> 5) J: within-subject factor (2 levels: J1 / J2)

Hi Gang,
I don't know whether this is the format you want, but:

library(prettyR)
rep_n_stack(mydata,matrix(c(2,3,6,7,4,5,8,9),nrow=2,byrow=TRUE))

Jim