df <- data.frame(
ID_1 = 1:5,
ID_2 = 1:5,
ID_3 = 1:5,
ID_4 = 1:5)
I want to replace each column with "participantID_" and a digit that has a value of +1 of the digit in the original columns.
As follows:
ID_1 should be participantID_2, ID_2 should be participantID_3...
How can I achieve this?
regexprto match the number,regmatchesto extract it, and then overwrite the originalnames(df):