1

I'm trying to create an R script that would create a new column that will reset the Index column. Based on when the values changed in the Name column.

Started with creating an Index column that will generate sequence rows.

df$Index <- seq.int(nrow(df))

Now I'm stuck on the part of resetting the Index values when the value changes from Test A to Test B.

Index   Name    Date
1       Test A  10/1/2015
2       Test A  11/1/2015
3       Test A  12/1/2015
1       Test B  1/1/2016
2       Test B  2/1/2016
3       Test B  3/1/2016
4       Test B  4/1/2016
1       Test C  5/1/2016
2       Test C  6/1/2016
3       Test C  7/1/2016
MrFlick
  • 195,160
  • 17
  • 277
  • 295
RLW
  • 66
  • 5

0 Answers0