剛開始學習 JSL ,使用 JMP16
嘗試編寫腳本來創建具有選定行的子集數據表,選擇標準由列 (7) 中的數值定義。
以下腳本的主幹來自“表”選項卡下運行的“子集”。
Data Table( "Subset of 200 kinome all excel" ) <<
Subset(
Linked,
selected rows only(0),
row selection (select where (as column(7) >0.3) );
Selected columns only(0),
);
上述腳本的選擇不起作用。 子集表與原始表相同。
我錯過了什麼?
謝謝
你有幾個小問題。
- Selected Rows Only() 需要打開
selected rows only( 1 ),
- 這 ”;”在您的行選擇結束時終止了子集。它必須是“,”
row selection( select where( As Column( 7 ) > 0.3 ) ),
這是完整的代碼
Data Table( "Subset of 200 kinome all excel" ) << Subset(
Linked,
selected rows only( 1 ),
row selection( select where( As Column( 7 ) > 0.3 ) ),
Selected columns only( 0 ),
);
我根本不會使用這種方法,它在我的計算機上不起作用(仍然是子集中的所有行,並且沒有拋出錯誤/消息):
Names default to here(1);
dt=open("$SAMPLE_DATA\Big Class.jmp");
Data Table( dt ) << Subset(
Linked,
selected rows only( 1 ),
row selection( select where( As Column( 2 ) > 13 ) ),
Selected columns only( 0 ),
);
原因是,在“子集”的文檔中我找不到像“行選擇”這樣的選項,只有
, [number, number, ...])>,
看:子集數據表 (jmp.com)
危險在於,未知參數不會引發錯誤,因此難以調試。
此外,在該子集語句中選擇行時,我真的不能確定選擇在子集之前完成,所以它對我來說看起來不穩定。
我的解決方案是選擇子集語句之前的行,或者如下通過顯式選擇行號。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
Data Table( dt ) << Subset(
Linked,
rows( /* explicit rows [1,2,3] or conditionally: */ Loc( (dt:age << get values) > 16 ) ),
Selected columns only( 0 ),
);