Extract rows from table depending on values before and after

I would like to analyse a list of data which has a wave form: the values typically grow up to a certain (undefined) point and from there they get smaller, grow up again, … The behaviour is similiar to temperatures over days, but I don’ know the period or anything else.
From that data stream I would like to extract all “high” points and put them to a new table.
My idea would be a “row filter” which can work with the data “before” and “after”:
If value in current row is higher than row before and row after -> keep this entry

In the row filters I checked I was not able to see such a filter.

Are there any others nodes available which may help me?

Hi, @knimediger
The way to do this in KNIME would be to use the Lag Column node to create new columns with the previous and next values, and then implement your logic in a Rule Based Row Filter
You’ll need to use separate Lag Column nodes for the previous and next values.

Let me know if this makes sense.
-Corey.

3 Likes

Hi @Corey,

Thank you for hint. It helps to get the right values.

But the challenge is that I need to compare the previous and the next row. Using the Lag Column node I found only the solution to do this laging twice (for the previous row and the row before).
that gives me a dataset like

row value val-pre-row val-pre-pre-row
row1 | 1.0 | 0.0 | 0.0
row2 | 2.0 | 1.0 | 0.0
row3 | 3.0 | 2.0 | 1.0
row2 | 2.0 | 3.0 | 2.0

When I compare using the rule based row filter the “previous row” value with the actual one the the older one I have the right value.
In this case I will find in row 3 the right value 3.0. But that value originates from the previous row.
So I need to add some more steps to really get the row 2 (that row does contain some more relevant details)

Ah I understand, that extra data does complicate that.
The best solution that comes to mind is to use the Moving Aggregation node with the bellow configuration. I can do a forward calculation and grab the next value for you. That should make your original value the center point.

01%20PM

It’s a bit of a work around but hopefully it helps.

1 Like

Update
The solution was rather easy:
I also lagged the row-id. Then I applied the reference row filter to catch from the original table all these rows.

Edit: To some unknow reason I’m not able to mark this thread as solved (can’t edit the first entry :frowning: =

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.