I'd like to rename a column using dplyr in a dynamic way by using a variable. However, it just names the column what the variable is called, rather than its content. Any ideas??
colnames(y)
[1] "time"         "channel_1"    "channel_2"    "channel_3"    "channel_4"    "channel_5"    "correction"   "channel.corr"
ladder.channel <- "channel_4"
fsa.bc <- y %>%
    select(-c(all_of(ladder.channel), "correction")) %>%
    rename(ladder.channel = channel.corr)
colnames(fsa.bc)
"time"           "channel_1"      "channel_2"      "channel_3"      "channel_5"      "ladder.channel"
 
     
    