列分数反向排序选项?大家好,
有没有简单的方法可以使用 `Col Score()` 函数反转排序?默认情况下,它是按降序排列的,所以数值最高的项得分最高,数值最低的项得分为 1。我希望数值最高的项得分为 1,数值最低的项得分为最低。
感谢您的任何意见!
回复:列分数反向排序选项?我的做法是这样的
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "Score Height",
formula( col score(:Height))
);
New Column( "Height reverse",
Formula( col max(:height)-:height + col min(:height))
);
current data table()<
<RERUN formulas=""></RERUN>
回复:列分数反向排序选项?例如,您可以将其与列编号结合使用。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("Score Height", Formula(Col Score(:height)));
dt << New Column("Score Height Reverse", Formula(Col Number(:height) - Col Score(:height) + 1));
dt << New Column("Score Height by age", Formula(Col Score(:height, :age)));
dt << New Column("Score Height by age Reverse", Formula(Col Number(:height, :age) - Col Score(:height, :age) + 1));
Write();
jthi_0-1790138853222.png
回复:列分数反向排序选项?感谢@jthi和@txnelson 的帮助。在你们的指导下,我最终得到了一个运行良好的方案。
适用于单列
Col Score( :height ) * -1 + 1 + Col Maximum( Col Score( :height ) )
用于按列显示:
Col Score( :height, :sex ) * -1 + 1 + Col Maximum( Col Score( :height, :sex ), :sex )
感谢您的快速回复!
史蒂夫