I have a data frame with 563 columns in which I would like to change the names of column variables in all except the first 2 columns using a character vector(Cnames) of length 561. I tried using:
colnames(df[,3:563]) <- Cnames
But nothing happens here. But if I try changing the names of all column variables as follows then renaming works:
CoName <- c("char0", "char01", Cnames)
colnames(df) <- CoName
Can someone tell me why this happens? Thanks in advance.