列分數反向排序選項?大家好,
有沒有簡單的方法可以用 `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 )
感謝您的快速回覆!
史蒂夫