cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

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