cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

Discussions

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

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 )

Recommended Articles