Clustered Data to Cycle Count

Good evening, 

 

I´m new to KNIME and not the best programmer, so I guess this is a quite basic question.
Nevertheless I hope to find some help, because I´m a bit lost at the moment.

I have successfully clustered my Data and now I´d like to implement a "Cycle-Count" as a result if you will.
The table at the bottom shows the desired result.

I´d like to produce the result seen in the table below. The count depends on a CHANGE of the string-value in the  
"Cluster [String]" Column.

  • With each change the count number should increase by +=1
  • when the cluster_x stays the same, the count does not increase
  • I also thought about transforming the cluster strings into a certain integer value to use some kind of if statement, but I´d prefer to leave the strings as strings, because I don´t know the exact amout of clusters yet.

 

I would be thankful for any kind of help! 

 

Markus

 

The desired Result: 

Random Data Cluster [String] Cycle-Count [int]
...

cluster_1

1
... cluster_1 1
... cluster_1 1
... cluster_3 2
... cluster_3 2
... cluster_1 3
... cluster_2 4
.l.. cluster_2 4
... cluster_2 4
... cluster_3 5
... cluster_3 5
... cluster_3 5
... cluster_1 6
... cluster_1 6

 

Hi Markus,

 

I'm not sure if there's one single node that does the job.

I used the "Lag Column" Node and then compared the values of the original column to the values of the lagged column using the "Java Snippet" Node, increasing the value by 1 whenever they're not the same. 

Find attached an example workflow. Does that help you?

 

Cheers,

Michael