Say my dataset contains three columns: identifier (identifier), register (character), and value (numeric). This is my dataset:
tdata <- data.frame(id=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4), case=c("a","b","c","c","a","b","c","c","a","b","c","c","a","b","c","c"), value=c(1,34,56,23,546,34,67,23,65,23,65,23,87,34,321,56)) tdata id case value 1 1 a 1 2 1 b 34 3 1 c 56 4 1 c 23 5 2 a 546 6 2 b 34 7 2 c 67 8 2 c 23 9 3 a 65 10 3 b 23 11 3 c 65 12 3 c 23 13 4 a 87 14 4 b 34 15 4 c 321 16 4 c 56
If you notice that for each ID we have two c. How to rename them c1 and c2? (I need to distinguish them for further analysis).