Skip to content
Prev 247433 / 398503 Next

data prep question

Here is one way

Here is one way:
+ ID              TIME    OBS
+ 001             2200    23             
+ 001             2400    11             
+ 001             3200    10     
+ 001             4500    22
+ 003             3900     45     
+ 003             5605     32
+ 005             1800    56
+ 005             1900    34
+ 005             2300    23")
+ colClasses = c("factor", "numeric", "numeric"))
+ function(x) within(x, TIME <- TIME - min(TIME)))
ID TIME OBS
1 001    0  23
2 001  200  11
3 001 1000  10
4 001 2300  22
5 003    0  45
6 003 1705  32
7 005    0  56
8 005  100  34
9 005  500  23