我们的数据有十次重复(重复,更准确)。所需的数据介于 35 到 70 英里/小时的车速之间。对于 10 个重复中的每一个,都存在一个标记为“时间”的列,由于实验程序的变化,该时间指示略有不同。
我想使用 JMP 命令而不是脚本为“调整时间”创建一个计算列。
在此列中,该值将通过从每个时间值中减去以 35 mph 的第一速度指示的第一时间而归零。对于十次重复,该列必须以某种方式检查重复列,并且在第一次进行新重复时,更改该重复的 35 mph 值时间数据的调整时间。这样,每个“调整时间”列将从零开始,以 70 英里/小时结束。
任何想法如何自动执行此任务?提前致谢。
根据以下条件,可以更容易地执行公式:
- 数据已排序
- 如果 35mph 每次重复只出现一次
- 如果 35mph 总是最小的时间值
因为没有提供这些信息或者我确实理解错误,所以我使用了一个更复杂的公式:
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(12),
Compress File When Saved(1),
New Column("Repeat",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4])
),
New Column("Speed",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([35, 35, 70, 35, 40, 70, 35, 36, 70, 60, 35, 36])
),
New Column("Time",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 2, 3, 1.1, 2, 3, 1.2, 2, 3, 1, 2, 3])
)
);
dt << New Column("Adjusted Time",
Numeric,
"Continuous",
Formula(
If(Row() == 1,
//Find rows with speed of 35
speedRows = Loc(:Speed << get as matrix, 35);
//get repeats for 35 rows
repeats = :Repeat[SpeedRows];
);
//time for first 35mph for current rows repeat
curTime = :Time[Loc(repeats, :Repeat)[1]]; //adjusted time
:Time - curTime;
)
);