I want to add a label to my dataset. However, the problems is that there are so many columns in my data sets so adding the labels manually is laborious.
I have 33 co
You can use paste0 command
> c(paste0("f", 1:32), "label")
[1] "f1" "f2" "f3" "f4" "f5" "f6" "f7" "f8" "f9" "f10" "f11" "f12"
[13] "f13" "f14" "f15" "f16" "f17" "f18" "f19" "f20" "f21" "f22" "f23" "f24"
[25] "f25" "f26" "f27" "f28" "f29" "f30" "f31" "f32" "label"
This will do the job
colnames(urc_training_norm) <- c(paste0("f", 1:32), "label")