cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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