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?
-
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.