Sample of mydataset
datatrain=structure(list(DELT = c(10266L, 10266L, 10266L, 9635L, 9635L,
9635L, 10334L, 10334L, 10061L, 10061L, 10061L, 9512L, 9512L,
9512L, 10394L, 10394L, 9631L, 10376L, 10376L, 10376L, 10376L,
10046L, 9678L, 10332L, 10332L, 9985L, 9850L, 9850L, 10074L, 9746L,
9746L), EP_OBJECTID = c(86913544L, 86913544L, 86913544L, 86913544L,
86913544L, 86913544L, 86913544L, 86913544L, 86913544L, 86913544L,
86913544L, 86913544L, 86913544L, 86913544L, 86913544L, 86913544L,
86913544L, 86913544L, 86913544L, 86913544L, 90093693L, 90093693L,
90093693L, 90093693L, 90093693L, 90093693L, 90093693L, 90093693L,
90093693L, 90093693L, 90093693L), DELTDMR = c(0L, 0L, 0L, 8L,
8L, 8L, 0L, 0L, 2L, 2L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 65L, 65L,
65L, 65L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 3L, 3L)), class = "data.frame", row.names = c(NA,
-31L))
EP_OBJECTID is categorical variable. Here only two categories
86913544
90093693
how to set the sequence number from the first value of the category 86913544
to the last number before the new category 90093693
in range 10000?
i.e. result
DELT EP_OBJECTID DELTDMR
10000 86913544 0
20000 86913544 0
30000 86913544 0
40000 86913544 8
50000 86913544 8
60000 86913544 8
70000 86913544 0
80000 86913544 0
90000 86913544 2
100000 86913544 2
110000 86913544 2
120000 86913544 0
130000 86913544 0
140000 86913544 0
150000 86913544 0
160000 86913544 0
170000 86913544 0
180000 86913544 65
190000 86913544 65
200000 86913544 65
And how then to remove the last value of category =86913544
(= 65) which goes before the first value of the new category. In this example, the new category 90093693
also has a value of 65, but new counting begin from second value of category 90093693
(=0). Also in range 10000
I.E. result
DELT EP_OBJECTID DELTDMR
10000 86913544 0
20000 86913544 0
30000 86913544 0
40000 86913544 8
50000 86913544 8
60000 86913544 8
70000 86913544 0
80000 86913544 0
90000 86913544 2
100000 86913544 2
110000 86913544 2
120000 86913544 0
130000 86913544 0
140000 86913544 0
150000 86913544 0
160000 86913544 0
170000 86913544 0
180000 86913544 65
190000 86913544 65
200000 86913544 65
10000 90093693 0
20000 90093693 0
30000 90093693 0
40000 90093693 0
50000 90093693 0
60000 90093693 0
70000 90093693 0
80000 90093693 0
90000 90093693 3
100000 90093693 3
and this for each category. How to perform it?