- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to select a subset of columns and rows from a data table
There are a couple of issues.
- You are using double "||" instead of single "|" for the OR in your Select Where
- 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 )
);