我有兩個從資料集中提取的列表,一個列表包含列名稱,另一個列表包含基於某些條件提取的某些值(每列一個值)。
List1 = {體重,攝氧量......};
列表2 = {38,59.08.....};
在此步驟之後,使用者將獲得如下所示的 JMP 表作為輸出,其中包含是否刪除腳本提取的值的選項:

使用者要么從主表中刪除該值,要么決定保留它。
我進一步嘗試做的是:
1)我運行一個腳本來尋找最小值,如果該值與該列的值相符(這意味著使用者決定保留該值),我想獲得下一個最小值
2)如果不是,我會按原樣提取最小值。
dt = current data table();
colNamesList = dt << get column names( string, numeric, continuous );
nc = N Items( colNamesList );
Names = {};
MinVals = {};
MinValList = {};
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
Insert into(Names, colNamesList[i]);
MinValue = Col Min( Cols );
Insert into(MinVals, MinValue);
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
Insert into(MinValList, MinRows[1]);
);
dt1 = new table( "Data",
New Column( "Column Name", character, nominal, values(Names)),
New column( "Min value", numeric, nominal, values( MinVals)),
New Column( "Row Number", expression, nominal, values( MinValList ));
);如何匹配值以檢查每一行用戶是否已刪除該值?
//Second Part
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
colMin = Col Min( Cols );
//If value in Col min is equal to value in MinValue, then skip that value and choose the next minimum value, else add that value to a new list
@cwillden抱歉,它仍然對我不起作用。 我只想檢查 Linnerud 表的欄位中是否仍然存在最小值。 但我無法使該腳本正常工作。
我可能應該在 row_temp 定義的末尾包含一個「[1]」。 抱歉,我在這裡有點魯莽,沒有實際通過 JMP 和示例數據表運行它。確保在新增 [1] 之前將整個內容括在括號中。
(row_tmp <SPAN class="token operator">=</SPAN> dt1 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Get Rows Where</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">:</SPAN>Column Name <SPAN class="token operator">==</SPAN> Cols<SPAN class="token punctuation">))[1]</SPAN><SPAN class="token punctuation">;</SPAN>
您可能還在比較名稱物件而不是字串。若要取得字串形式的列名稱,請嘗試以下操作:
Cols = Column(dt, 1) << Get Name;
我認為有了這兩個改變,它應該會起作用。
你可以這樣做:
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
colMin = Col Min( Cols );
//If value in Col min is equal to value in MinValue,
//then skip that value and choose the next minimum value, else add that value to a new list
//get the corresponding row in the table (if it doesn't align with the index of your loop)
row_tmp = dt1 << Get Rows Where(:Column Name == Cols);
if(Min value[row_tmp] == colMin,
//Insert Code to look for next smallest value
)
)
row_tmp 取得 dt1 中 Column Name 的值與 Cols 中目前列名稱相符的行。