如何计算行值的变化?我有一个很大的数据集,其中有重复值块,如下所示:
A
A
乙
A
C
C
C
我想计算行值的更改数量,或者换句话说,计算忽略连续重复行的行数。在此示例中,计数将为 4(第三个“A”是“B”的更改,因此它计数)。有没有办法让 JMP 计数行而忽略重复和连续的重复项?
我正在使用 JMP 15.2.1。
质量和工艺工程回复:如何计算行值的变化?似乎正在发挥作用!谢谢!
回复:如何计算行值的变化?一种方法是使用 Lag 创建公式,然后您可以获得该列的最大值
If(
Row() == 1,
counter = 1;
, Lag(:col, 1) != :col,
counter++
);
counter;
</CODE><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1647639220121.png" style="width: 400px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="jthi_0-1647639220121.png" style="width: 207px;"><span class="lia-inline-image-display-wrapper" image-alt="jthi_0-1647639220121.png" style="width: 207px;"><img src="https://us.v-cdn.net/6038925/uploads/images/40960i3683E856360E0C73/jthi_0-1647639220121.png" role="button" title="jthi_0-1647639220121.png" alt="jthi_0-1647639220121.png" /></span></SPAN></SPAN></P>
<P> </P>
<P> </P>
<P>也许这样的事情也可以工作:</P>
<P> </P>
<PRE><CODE class=" language-jsl">Col Cumulative Sum(Lag(:col) != :col)
回复:如何计算行值的变化?这里有几种方法来处理这个问题

Names Default To Here( 1 );
dt = Current Data Table();
For Each Row(
If(
Row() == 1, count = 1,
:column 1 != Lag( :column 1 ), count
++)
);
Show( count );
// Look in the log for the value of count
// or
dt << New Column( "The Count",
formula(
If(
Row() == 1, count = 1,
:column 1 != Lag( :column 1 ), count
++);
count;
)
);