cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
mostarr
Level IV

How to select a subset of columns and rows from a data table

I have done a Google search and come across the top hits, things like https://www.jmp.com/china/support/help/13-2/JSG_DataTables_21.shtml and How to select rows based on multiple criteria? but nothing specifically states how to select both columns and rows in the same line of code. I tried it and doing one seems to interfere with the other. Or is there a way to store the output of the first step (column subset) into a variable and then do the second (row subset)? I didn't try that yet, the idea just came to me.

 

Here's my code:

dt << Select where( Timepoint == "cell value 1" || Timepoint == : "cell value 2" || Timpeoint == "cell value 3"  );
dt_subset = dt << Subset (Columns(:"Instrument Type", :Donor ID, :Timepoint, :Instrument Channel, :Run date));

 

1 REPLY 1
txnelson
Super User

Re: How to select a subset of columns and rows from a data table

There are a couple of issues.

  1. You are using double "||" instead of single "|" for the OR in your Select Where
  2. In your Subset, using Selected Rows( 1 ) indicates to JMP to only subset the selected rows

I also changed your column reference to Instrument Type.  There is no need to have it in quotes.  It does not contain any special characters that might confuse JMP, so therefore the quotes are not necessary.

dt << Select where(
	:Timepoint == "cell value 1" | :Timepoint == "cell value 2" | :Timpeoint ==
	"cell value 3"
);
dt_subset = dt << Subset(
	Columns( :Instrument Type, :Donor ID, :Timepoint, :Instrument Channel, :Run date ),
	selected rows( 1 )
);
Jim

Recommended Articles