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

Randomly select rows within a given column value

Hello everyone, 

 

First of all, I'm an occasional JMP user (v16.2) with little JSL experience and limited statistical knowledge. I couldn't directly find an answer on the community, I hope I'm not asking something which has already been answered. That being said, I've been trying to figure out how to do the question below 'manually' - using standard JMP functionalities. I couldn't find any simple way, so I hope somebody can give me a hint using JSL.

 

For a particular application request I would like to subset a large data table. More specifically, I would like to subset the table by randomly taking out a number of rows, for a specific column value. For example, I'd like to transfer the table attached to a new table, where I can obtain 3 (randomly chosen) values of column "Numerics" for each column value of column "condition". 

Apart from the JSL solution, is there maybe a way to do this using any of the statistical platforms?

 

Thanks for the help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Victor_G
Super User

Re: Randomly select rows within a given column value

Hi @Nico_M,

 

Welcome in the Community !

If I understood correctly your need, you should be able to do this using the "Subset" platform in menu "Tables" :

  1. Click on menu "Tables", then "Subset" ; a new window opens,
  2. Specify "random - sample size" as 3 (or any number of rows you want per condition) and select stratify and choose the column "Condition" (as shown in the screenshot) :
    Victor_G_0-1676645019872.png

     

  3. Click on "Ok" and you'll get a new subset table

 

Here is the JSL code on your example if you want to directly use it :

 

Data Table( "JMP replicates - community" ) << Subset(
	Sample Size( 3 ),
	Selected columns only( 0 ),
	Stratify( :Condition )
)

I also send you back your datatable with the Subset table saved as a new script.

Hope this answer will help you, 

 

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics

View solution in original post

2 REPLIES 2
Victor_G
Super User

Re: Randomly select rows within a given column value

Hi @Nico_M,

 

Welcome in the Community !

If I understood correctly your need, you should be able to do this using the "Subset" platform in menu "Tables" :

  1. Click on menu "Tables", then "Subset" ; a new window opens,
  2. Specify "random - sample size" as 3 (or any number of rows you want per condition) and select stratify and choose the column "Condition" (as shown in the screenshot) :
    Victor_G_0-1676645019872.png

     

  3. Click on "Ok" and you'll get a new subset table

 

Here is the JSL code on your example if you want to directly use it :

 

Data Table( "JMP replicates - community" ) << Subset(
	Sample Size( 3 ),
	Selected columns only( 0 ),
	Stratify( :Condition )
)

I also send you back your datatable with the Subset table saved as a new script.

Hope this answer will help you, 

 

Victor GUILLER
Scientific Expertise Engineer
L'Oréal - Data & Analytics
Nico_M
Level I

Re: Randomly select rows within a given column value

Thanks! I completely missed the 'stratify' option, it was indeed very simple ;).