Suffix for duplicates

Hi :slight_smile:
I have one table containing different entries for same IDs, like this:
entries|ID
x|1
y|1
z|1
t|2
p|2
and so on…

How can I append a suffix to the IDs to have a unique ID for each entry? Like in this example:

x|1_1
y|1_2
z|1_3
t|2_1
p|2_2
and so on…

I am trying with loops for extracting all entries per each ID but in the string manipulation I could not find any helpful function. Do you have any idea?

I would be immensely grateful!

Cheers,

Silvia

Hi there @ChineS,

idea is following:

  1. Use Counter Generation node to add Counter column
  2. Follow that with Rank node where ranking column is Counter (ascending) and group column is ID column
  3. Finish it with String Manipulation where you use join() function to join ID column and Rank column with underscore between them.

If any questions/comments feel free to ask. Hope this idea helps!

Br,
Ivan

4 Likes

Hi Ivan,

thank you so much!
Firstly I discovered this super useful KNIME extension and, after converting also the Counter column to string, it worked! I am now executing the same in a loop grouping each and every ID.

Thanks again!

Silvia

1 Like

Hi @ChineS,

glad to hear that. You are welcome :slight_smile:

Br,
Ivan

1 Like

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