i try be clearly.
here data
dt=structure(list(x1 = c(28.5, 25.5, 28, 27, 29), x2 = c(28.5, 25.5,
25, 25.5, 29), x3 = c(8, 5.5, 8.5, 7.5, 8), x4 = c(8.5, 6.5,
6.5, 5.5, 8), x5 = c(64L, 55L, 54L, 55L, 60L), x6 = c(63.5, 54.5,
53.5, 54.5, 60), x7 = c(1028L, 1010L, 1008L, 1010L, 1020L), x8 = c(1027L,
1009L, 1007L, 1009L, 1020L)), class = "data.frame", row.names = c(NA,
-5L))
I need to find row where at the same time, MINIMUM (at least) 2 of the above variables (x1-x8)
changed sharply in the values simultaneous. For example abruptly and simultaneously (this is important) grew up x2, x4, x8
and no matter how much they jumped up, the very fact of a simultaneous (for several variables at the same time) and abrupt event. So we can calculate difference(delta) for x2= 25.5-28.5 = -3
x2 x4 x8
1 -3.0 -2.0 -18
2 -0.5 0.0 -2
3 0.5 -1.0 2
in general, the difference between before after for each variable is even, x8 jumped sharply down, but others are in their range, but it is necessary that all at once or at least 2 variables.
And this we can observe in last row.
4 3.5 2.5 11 changes last row
Is it possible to set the flag = 1 for row where we see extreme grow.
x1 x2 x3 x4 x5 x6 x7 x8 flag
1 28.5 28.5 8.0 8.5 64 63.5 1028 1027 0
2 25.5 25.5 5.5 6.5 55 54.5 1010 1009 0
3 28.0 25.0 8.5 6.5 54 53.5 1008 1007 0
4 27.0 25.5 7.5 5.5 55 54.5 1010 1009 0
5 29.0 29.0 8.0 8.0 60 60.0 1020 1020 1
if this is not possible, then is it possible to set that if at least 2 variables among x1-x4 grew up on 2 mm up and and at the same time variable x7-x8 grew up on 10 mm then flag 1 ?
question from:
https://stackoverflow.com/questions/65926328/detecting-sharp-bursts-in-several-variables-simultaneously-in-r