【发布时间】:2017-07-24 20:04:31
【问题描述】:
看下面的数据框
1 1 3
2 1 6
3 1 7
2 1 6
3 1 7
4 1 8
5 1 13
6 0 10
5 1 13
4 1 12
5 1 13
6 1 14
7 NA NA
8 0 16
7 NA NA
6 NA NA
在左栏我有一个小样本。
在中心栏我有一个测试值:if the number on the left eventually rises by a value of 2 before dropping by a value of 2, the binary value is "1", if the number declines first by 2 before rising 2, the binary is "0"
在第三列,我想要满足条件的位置
2 上升到 4...假人是“1”...最后一列说“4”在位置 6
6 在达到 8 之前下降到 4,所以虚拟是“0”。最后一列表示特定的“4”在位置 10
编辑:
谢谢马特
【问题讨论】: