I got a df such a this
structure(list(id = c(1162, 1162, 1162, 1388, 1388, 1388, 1492,
1492, 1492), chapter = c(1, 2, 1, 3, 4, 5, 2, 1, 3)), class = "data.frame", row.names = c(NA,
-9L))
and I want to replace the id column values with numbers to make it look like this
structure(list(id2 = c(1, 1, 1, 2, 2, 2, 3, 3, 3), chapter = c(1,
2, 1, 3, 4, 5, 2, 1, 3)), class = "data.frame", row.names = c(NA,
-9L))