cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
GroupSquareWolf
Level III

JSL-create subset data table with row selection defined by column value

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

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: JSL-create subset data table with row selection defined by column value

Edited code after @Georg found my code in error. 

You have a  couple of small issues.

  1. The Selected Rows Only() needs to be turned on
    selected rows only( 1 ),

     

  2. The Select Where needs to be moved to being an independent statement
    Data Table( "Subset of 200 kinome all excel" ) <<
    row selection( select where( As Column( 7 ) > 0.3 ) );

Here is the complete code 

Data Table( "Subset of 200 kinome all excel" ) <<
row selection( select where( As Column( 7 ) > 0.3 ) );
Data Table( "Subset of 200 kinome all excel" ) <<
Subset(
	Linked,
	selected rows only( 1 ),
	Selected columns only( 0 )
);

 

Jim

View solution in original post

Georg
Level VII

Re: JSL-create subset data table with row selection defined by column value

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 

<Selected Rows>, <Rows([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 ),
);

 

Georg

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: JSL-create subset data table with row selection defined by column value

Edited code after @Georg found my code in error. 

You have a  couple of small issues.

  1. The Selected Rows Only() needs to be turned on
    selected rows only( 1 ),

     

  2. The Select Where needs to be moved to being an independent statement
    Data Table( "Subset of 200 kinome all excel" ) <<
    row selection( select where( As Column( 7 ) > 0.3 ) );

Here is the complete code 

Data Table( "Subset of 200 kinome all excel" ) <<
row selection( select where( As Column( 7 ) > 0.3 ) );
Data Table( "Subset of 200 kinome all excel" ) <<
Subset(
	Linked,
	selected rows only( 1 ),
	Selected columns only( 0 )
);

 

Jim
Georg
Level VII

Re: JSL-create subset data table with row selection defined by column value

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 

<Selected Rows>, <Rows([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 ),
);

 

Georg
GroupSquareWolf
Level III

Re: JSL-create subset data table with row selection defined by column value

Thank you for your help!