Hi,

reshape(df, direction="wide", idvar="subj",
timevar="condition")[,c(2,1,3,5)]

On 27/11/2007, Dieter Vanderelst <[EMAIL PROTECTED]> wrote:
>
> Dear R-list,
>
> Is there a way to convert the typical long R data-format to a 1-line per
> subject format?
>
> I have data formatted as:
>
> Group   subj    condition       variable
> 1       1       1       746.36625
> 2       2       1       1076.152857
> 1       3       1       1076.152857
> 2       4       1       657.4263636
> 1       5       1       854.1266667
> 2       6       1       1191.676154
> 1       7       1       1028.175385
> 1       1       2       46.36625
> 2       2       2       76.152857
> 1       3       2       76.152857
> 2       4       2       57.4263636
> 1       5       2       54.1266667
> 2       6       2       191.676154
> 1       7       2       028.175385
> ...
>
> Here, one line equals the value of one subjects  VARIABLE in function of
> the GROUP and the CONDITION.
>
> However, I would like to rearrange the data so that the columns of my data
> equal the 2 conditions and the lines the subjects. This is something like:
>
> subj    group   condition1      condition2
> 1       1       746.36625       46.36625
> 2       2       1076.152857     76.152857
> ...
>
> I know its possible the other way around. But that's not what I need (this
> time).
>
> Before anyone asks: Yes, I want to do some analysis on my data in SPSS, so
> I need the rearranged format.
>
> Regards and Thanks,
> Dieter
> ------------------------------------------
> Dieter Vanderelst
>
> dieter _ vanderelst AT emailengine DOT org
> d DOT vanderelst AT tue DOT nl
>
> Eindhoven University of Technology
> Faculty of Industrial Design
> Designed Intelligence Group
> Den Dolech 2
> 5612 AZ Eindhoven
> The Netherlands
> Tel +31 40 247 91 11
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to