I would like to rename my columns from my data frame which have duplicated column names where my columns are a,b and c.
df>
a b c a b c
1 6 11 1 4 4
2 7 12 2 8 12
3 8 13 3 7 7
4 9 14 5 7 11
5 10 15 44 2 13
I could change the columns name by taking out column 1:3 as df1, but is there a way to loop it if I have 1000 column names to change?
df1 <- df[,1:3]
colnames(df1) <- paste(colnames(df1), "test1" , sep = '_')