cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
juliet
Level I

Creating a subset of selected Rows in a datatable

Hi All,

I'm fairly new to JSL, and am hoping to get some assistance with an issue I've run into.

I'm trying to create a subset of selected rows (with all columns preserved) from a datatable, but in spite of trying just about everything I can find on these forums, in the JMP scripting guide, and in "Jump into JMP Scripting", I haven't been able to get this to happen.

The closest I've come is with the following, which creates the subset table, but includes all rows rather than just the ones I've selected (and the rows I want ARE selected in the main table) and also eliminates some columns.

data table("JoinedOutput") <<Select Where (Dilution==0.00005);

selRows = N row( dt << Get Selected Rows );

dt << Subset( output table name("JoinedSubset"));


What are people's thoughts? Any and all help is much appreciated!

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Creating a subset of selected Rows in a datatable

It should work. But are you sure that dt really is the data table "JoinedOutput" and not another table (perhaps the original table before joining...)?

 

However, Subset() may produce more predictable results with some optional arguments. Try something like this:

 

 

dt = Data Table( "JoinedOutput" );
dt << Select Where( :Dilution == 0.00005 );
dt << Subset( Output Table( "JoinedSubset" ), Selected Rows( 1 ), selected columns( 0 ) );

 

View solution in original post

5 REPLIES 5
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Creating a subset of selected Rows in a datatable

It should work. But are you sure that dt really is the data table "JoinedOutput" and not another table (perhaps the original table before joining...)?

 

However, Subset() may produce more predictable results with some optional arguments. Try something like this:

 

 

dt = Data Table( "JoinedOutput" );
dt << Select Where( :Dilution == 0.00005 );
dt << Subset( Output Table( "JoinedSubset" ), Selected Rows( 1 ), selected columns( 0 ) );

 

juliet
Level I

Re: Creating a subset of selected Rows in a datatable

It's interesting that you should ask that question, because at an earlier point in my script i have specified:

dt=data table("JAT-00047 Day 0-45 concat");


which is the initial table used in my analysis. The subset step is coming several steps later, on the 3rd table used in the analysis. My understanding was that by specifying:

data table ("JoinedOutput")

I could specify that I wanted a subset of this table, but now I'm guessing this is wrong?

Will I encounter a problem using the dt = Data Table ( "JoinedOutput" ) here if I've used it as shown above earlier in the script?

Thank you!

pmroz
Super User

Re: Creating a subset of selected Rows in a datatable

The safest thing is to have a separate variable for each table.  Avoids confusion that way.  Referring to a table via data table("Table title") works but is a little more verbose.

FrankBot0211
Level II

Re: Creating a subset of selected Rows in a datatable

Hi,

 

Can you explain what is the returning of Selected Rows(1), and Selected Columns(0). without that script does not work.

David_Burnham
Super User (Alumni)

Re: Creating a subset of selected Rows in a datatable

Subset performs the same task as the Subset option on Tables menu of JMP.  If you look at that option you will see that when you subset you have to indicate whether or not to use all rows and columns, or only selected rows and/or columns.

The arguments are providing the same information: Selected Rows(1) says that you want to use only the selected rows; Selected Columns(0) means you don't want to use selected columns (by implication, you want to use all columns).  

-Dave