Hi, R experts:

I am asking for helps with manipulating this data: we have different groups:
A,B, C, and so on. In each group, we have different students, for example,
we have 6 students in A and 5 students in B. Each student gives a rating,
which ranges from 1 to 3.

We want to manipulate this data and add three more variables called as 1, as
2 and as 3. For example, in group A, for each student, we count the #
of student before this student provides rating as 1, rating as 2 and rating
as 3. For example, for student 2 in group A, there are 0 students before
him/her provide rating as 1, there are 0 students before him/her provide
rating as 2,  there are 1 students before him/her provide rating as 3. For
student 3 in group A, there are 0 students before him/her provide rating as
1, there are 1 students before him/her provide rating as 2,  there are 1
students before him/her provide rating as 3.

group   student  rating  as 1  as 2   as 3
A             1          3       --      --       --
A             2          2       0      0        1
A             3          2       0      1        1
A             4          3       0      2        1
A             5          1       0      2        2
A             6          2       1      2        2
A             7          3       1      3        2
B             1          2       --      --       --
B             2          3       0      1        0
B             3          3       0      1        1
B             4          1       0      1        2
B             5          1       1      1        2

Best

Jay

	[[alternative HTML version deleted]]

