Just started learning JSL , using JMP16
Trying to write a script to create a subset data table with selected row, the selection critera are defined by numeric values in column(7).
The backbone of the following script is from "subset" run under the "Tables" tab.
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),
);
The selection of the above script did not work. The subset table is identical to the original one.
What did I miss?
Thanks
You have a couple of small issues.
- The Selected Rows Only() needs to be turned on
selected rows only( 1 ),
- The ";" at the end of your row selection terminated the Subset. It needed to be a ","
row selection( select where( As Column( 7 ) > 0.3 ) ),
Here is the complete code
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 ),
);
I would not use this approach at all, and it doesn't work on my Computer (still all rows in subset, and no error/message thrown):
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 ),
);
The reason is, that in documentation of "subset" I couldn't find any option like "row selection", there is only
, [number, number, ...])>,
see: Subset a Data Table (jmp.com)
And the danger is, that unknown parameters don't thrown an error, so difficult to debug.
Additionally, when selecting rows within that subset statement, I would't really be sure that selecting gets done before the subset, so it doesn't look stable to me.
My solution would be either to select the rows before the subset statement, or as below by explicitly selecting the row numbers.
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 ),
);