Hi,
I have two columns: one concerning quantitative data (V1), the other
concerning the identification of the repeated measures made on the
same units (V2) ; here, there is 3 measures on the first unit, 4
measures on the 2d unit, and so one...
V1 V2
1 5 1
2 3 1
3 6 1
4 4 2
5 7 2
6 8 2
7 9 2
8 6 3
9 5 3
10 2 4
11 31 4
I would like to obtain (ideally...) a data frame or matrix with the
ident variable and the difference between measures made on the same
unit: something as returned by
> tapply(as.vector(SDF1$V1),SDF1$V2,diff)
$"1":
[1] -2 3
$"2":
[1] 3 1 1
$"3":
[1] -1
$"4":
[1] 29
but in a suitable way (data array), that means:
ident diff
1 -2
1 3
2 3
2 1
2 1
.....
Thank you for your help,
Tristan
--
Laboratoire Central des Ponts et Chaussées
[Division ESAR ? Section AGR]
Route de Bouaye BP 4129
44341 Bouguenais Cedex
France
Tél 33 (0)2 40 84 56 18
Fax 33 (0)2 40 84 59 92
|