I am renaming the columns of a data frame(Data), in R, with the names stored in a character array.
If two names are same in the character array(Names), e.g ("JK","JK","test","hi")
using,
colnames(Data) <- Names
colnames(Data)
Output:
"JK" "JK.1" "test" "hi"
Desired output:
"JK" "JK" "test" "hi"
I am not able to figure out why .1 is appended to the second name.
Any suggestions on how to avoid this?