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
BHarris
Level VI

Data subset indexing tips

I have a bunch of concatenated test runs output that have columns:  time, position, speed, etc.

 

... and time goes from 0 to some number, e.g. 50, then resets to zero and starts up again.

 

I'd like to make a new column, setid, that indexes the sets, so the first set (time 0-50) gets a "1" in the setid column, the second set (time resets to 0...) gets a "2" in the setid column, etc.

 

Is there a smart/easy way to do this without resorting to .jsl scripting?  

 

I thought about doing "New formula column" -> Row -> Diff on the time column, and the negative times would indicate start of a new set, but then I'm back to writing a custom lag formula.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Data subset indexing tips

You can use a new column, index, with a formula for the group variable. The formula will look like this, assuming that the times are sequential:

 

If( :time > Lag( :time ), Lag( :index ), Lag( :index ) + 1 )

View solution in original post

1 REPLY 1

Re: Data subset indexing tips

You can use a new column, index, with a formula for the group variable. The formula will look like this, assuming that the times are sequential:

 

If( :time > Lag( :time ), Lag( :index ), Lag( :index ) + 1 )