> x <- data.frame(id=1:100, x1=sample(100), x2=sample(100), s1=1, s2=2,
s3=3, s4=4)
> require(reshape)
> z <- melt(x, id=1:3)  # first three columns are ids
> head(z,10)  # should be what you want
   id x1 x2 variable value
1   1 97 43       s1     1
2   2 89  5       s1     1
3   3 59 97       s1     1
4   4 91 86       s1     1
5   5 11 73       s1     1
6   6 27 79       s1     1
7   7 19 85       s1     1
8   8 24 26       s1     1
9   9 10 30       s1     1
10 10 38 67       s1     1
>


On Sun, May 31, 2009 at 2:06 PM, Christian Schmitt <
christian_...@hotmail.com> wrote:

>
> Hi,
>
>
>
> i have to reshape a dataset. my data have the following format:
>
>
>
> ID; x1; x2; x3; x4; v1; ... v20
>
> 1; 0.1; 0.3; 0.4; 0.2; 2; ... 3
>
> 2; 0.3; 0.7; 0.1; 0.2; 1; ... 4
> ...
> 999; 0.9; 0.6; 0.3; 0.1; 4; ... 2
> 1000; 0.2; 0.6; 0.7; 0.8; 1; ... 5
>
>
>
> ID is the number of persons (here 1000 persons)
>
> x are descriptive variables
>
> and v1-v20 are values of satisfaction on holidays for 20 days
>
>
>
> and now i should reshape the data such that each record contains only one
> participiant on one day
>
>
>
> could somebody help me? i don't know how to do this?!
>
>
>
> thank you
>
> _________________________________________________________________
> [[elided Hotmail spam]]
> [[elided Hotmail spam]]
>        [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[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