cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
new-jmper
Level III

Select rows with maximal values in one column

I can use summary to find the maximums (multiple due to groups) in one column. However, I also want to look up in which rows in the original table the maximums occur.

Is there an easy solution? Thanks for your help!
12 REPLIES 12
new-jmper
Level III

Re: Select rows with maximal values in one column

Jeff,

Thanks. This appears to be new feature from JMP 9. I am using JMP 7. I guess I may request an upgrade.

Also, I am trying to select multiple maximums in one column. The maximums belong to different groups specified in other columns.

Dong

Re: Select rows with maximal values in one column

I know this is two years later, but this is for all those who found this post with the same question.

Try the function "Get Selected Rows" in your script.

 

yourarray = dt << Get Selected Rows;

 

Now the array "yourarray" will contain a list of the row numbers that are selected.

 

To find the rows with the maximum value, try

 

// finds the maximum value in the columnt
peakvalue = Col Max( :columname); 

// selects all rows with the maximum value. (dt is the name of the data table.)
dt << Select Where( :columnname == peakvalue);

 // stores a list of the row numbers with the maximum value in this array
yourarray = dt << Get Selected Rows;    

 

pmroz
Super User

Re: Select rows with maximal values in one column

You can also use GET ROWS WHERE:

yourarray = dt << get rows where(:columnname == peakvalue);


The advantage of get rows where is that a) it's one step and not two, and b) no rows are selected in your table.  If you need the selected rows then the approach shown by MOSFETtestEng will do the trick.