Hi,
I have a data frame like that:
ID V2 V3
1 0.3 3
1 0.4 2
2 0.6 6
2 0.7 9
2 0.4 4
I would like to have:
ID V2 V3 V4
1 0.3 3 3
1 0.4 2 -1
2 0.6 6 6
2 0.7 9 3
2 0.4 4 -5
that means all the first data frame plus the difference between two
repeated values for V3 -- the repetitions are determined by the "ID"
variable. I tried combinations of diff and sapply functions, but
without any result...
Thank you,
Tristan Lorino
--
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
|