Iteration over a dataset to find a follower ID

analystanalyst Member Posts: 1 Contributor I
edited November 2018 in Help
Hi all,

I hope you can help me with a hopefully basic question.

I have a dataset with the attributes ID and Timestamp. I would like to set a new attribute with the direct follower of an example. Please compare the example below.

I tried with loops, but could not find out how to do it.

Thank you for any hints.

ID     |     Timestamp     |     Follower ID
1     |     01.01.2014 15:34     |    
2     |     02.01.2014 15:34     |     1
3     |     03.01.2014 15:34     |     2
4     |     04.01.2014 15:34     |     3
5     |     05.01.2014 15:34     |     4
6     |     06.01.2014 15:34     |     5
7     |     07.01.2014 15:34     |     6
8     |     08.01.2014 15:34     |     7

Answers

  • awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello

    You could try modifying the process shown here http://rapidminernotes.blogspot.co.uk/2013/11/negative-and-positive-lags.html

    regards

    Andrew
  • bkrieverbkriever RapidMiner Certified Analyst, Member Posts: 11 Contributor II
    If the ID is generated in your process (so it will always be 1, 2, 3 etc.) with no filters being used between the step where the ID is created and when you want to generate the follower ID you could just use the Generate Attributes operator and make attribute name "FollowerID" and function expression "ID-1" (with no quotes).
Sign In or Register to comment.