有什么方法可以快速获取列中负值的数量?大家好!
我需要计算“到达延迟”列中负数的数量或百分比。
在 JMP 的菜单操作和公式中似乎找不到此功能。
excel中有一个=countif(,"<0") 可以做的很快。
JMP 要使用循环?
dt = Open( "$SAMPLE_DATA/Airline Delays.jmp" );

Re: 有什么方法可以快速获取列中负值的个数?dt = Open( "$sample_data/Airline Delays.jmp" );
s=As Constant( N Rows( Loc( dt[0, "Arrival Delay"] < 0 ) ));Wait(0);
好方法!!
Re: 有什么方法可以快速获取列中负值的个数?
我在 JSL 中使用它。
请给我具体的指示。
谢谢克雷格!Re: 有什么方法可以快速获取列中负值的个数?吉姆的回答很好;这里还有两个避免创建列但具有不同副作用的方法:
dt = Open( "$sample_data/big class.jmp" );
// using table subscripts, suitable for use in a column formula.
// As Constant calculates the result once, not for every row.
As Constant( N Rows( Loc( dt[0, "age"] < 15 ) ) ); // 27
// using row selection, suitable for JSL programs. Avoids a temporary
// matrix but does change the selection state of the table.
dt << selectwhere( age < 15 );
N Rows( dt << getselectedrows ); // 27
您选择什么取决于您是在列公式中还是在 JSL 程序中使用它; JMP 添加了 As Constant 函数(大部分)以支持需要进行昂贵计算的列公式。 没有它,JMP 会计算每一行的行数,从而导致 N^2 性能问题。
解释第一个示例:dt[0,"age"] 从表 (邮政). 0 表示所有行。 将该矩阵与 < 15 进行比较会返回一个包含 0 和 1 结果的矩阵。 Loc([ 1 0 1 0]) 返回一个较小的非零(真)结果位置矩阵。 NRows 或 NItems 报告元素的数量。 如果您在变量中捕获答案,那么 JSL 程序中不需要常量。
Re: 有什么方法可以快速获取列中负值的个数?谢谢吉姆!
这似乎是唯一的方法。Re: 有什么方法可以快速获取列中负值的个数?使用具有指定公式的转换变量
If(:Arrival Delay < 0, 1, 0)
然后在Summary Platform中使用Sum作为统计量