Here’s an example of a table having 10 rows with a column that contains an ordered list of numbers (1,2,3,4,8,9,10,15,16,17).
I need to output a table that lists consecutive value ranges, e.g. :
1-4
8-10
15-17
Any ideas?
Here’s an example of a table having 10 rows with a column that contains an ordered list of numbers (1,2,3,4,8,9,10,15,16,17).
I need to output a table that lists consecutive value ranges, e.g. :
1-4
8-10
15-17
Any ideas?
Hi @bkrogman
Welcome to KNIME Forum. Yes I have an idea. I needed quite a few node to fix your problem. But at least I works…? See consecutive numbers.knwf (56.4 KB)
gr. Hans
The simplest solution to use K-Mean node with 3 clusters. Then use Group by with Min and Max functions to get borders of clusters. And finally String manipulation node to get range as
you wish join(Min_B, " - ", Max_B)
Wow, works like a dream. Thank you!
Hello,
here is a solution with slightly less nodes. Trick is to use ROWINDEX from Rule Engine node to determine group.
consecutive numbers_ipazin.knwf (39.1 KB)
Welcome to KNIME Community @bkrogman!
Br,
Ivan
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.