專家您好,
如何使用 JSL 從許多列中選擇前 5 個最高值單元格並為其著色?
例子:
從列 Type_A 到 Type_D 中的所有儲存格(這些列名稱的相似之處是包含「_」)
我想選擇前 5 個最高值單元格並用黃色著色。
看來「選擇位置」功能僅適用於比較兩列。
預期結果應該是這樣的;
0.14、0.12、0.11、0.1、0.9 是前 5 個最高值儲存格。

謝謝。
我正在使用 JMP 17.2
取得您要搜尋的所有列的列名稱。
新增包含行號的新列
堆疊您要搜尋的所有列。確保保留行列
按資料列的降序對堆疊的資料表進行排序
循環遍歷排序表的前 5 行,並根據「標籤」列(原始表中的列名稱)和「行」列設定原始表中的儲存格顏色。
刪除堆疊和排序的資料表
刪除原資料表中的Row列
嗨@jthi ,
我認為我們有這樣的公式 =Top(5, column("Type_A"):column("Type_D) << Color Cell (3);
其中 5 指從類型 A 列到類型 D 列的最高值的數量。
我會嘗試@txnelson解決方案。
謝謝 !
有一個使用矩陣的選項(吉姆建議的互動式解決方案更容易理解,也是我想到的第一個想法)
Names Default To Here(1);
// This table shows how this will behave with ties
// dt = Open("$SAMPLE_DATA/2D Gaussian Process Example.jmp");
// cols_of_interest = {"X1", "X2"};
dt = Open("$SAMPLE_DATA/Pogo Jumps.jmp");
cols_of_interest = {"Yat", "Yee", "Sam"};
m = dt[0, cols_of_interest];
v = Shape(m, N Items(m));
r = Ranking(v); // let Ranking decide our top5
idx = Loc(r > N Items(m) - 5);
vals = J(1, N Items(m), .);
vals[idx] = 1;
vals = Shape(vals, N Items(m) / N Items(cols_of_interest));
For(i = 1, i <= N Cols(vals), i++,
rows_to_color = Loc(vals[0, i]);
Column(dt, cols_of_interest[i]) << Color Cells("Yellow", rows_to_color)
);
Write();
Pogo Jumps.jmp - Yat、Yee、Sam

2D 高斯過程 Example.jmp - X1, X2(注意帶關係的行為)
