Home Forums Main Forums R Forum How to create a unique sequence number for each row?

  • How to create a unique sequence number for each row?

     Datura updated 4 years, 1 month ago 1 Member · 1 Post
  • Datura

    Member
    October 22, 2020 at 10:24 am
    Up
    0
    Down

    In real work, we often need to have a unique sequence ID for each row, or for each row in each group, such as 1, 2, 3……………… N. For example, for our RFM project, we need such a Sequence ID for segmentation.

    It is very easy to do it in SAS by using the SUM statement, however, not easy in R and Python. Can you work out the code for creating such a sequence ID for each row, and for each row of each group? How many different methods you can figure out?

    • This discussion was modified 4 years, 1 month ago by  Datura.

Log in to reply.

Original Post
0 of 0 posts June 2018
Now