I learned via this post (Adding a prefix to column names) how to change the names of all the variables in a dataset at once, but I can't seem to change the name of only a subset of those variables. The dataset has 358 variables in total, and I am able to add a prefix to all of the variables, but not just a subset.
I am using the following code, but the names don't seem to be changing.
colnames(y6t1data[,75:358]) <- paste("Y6T1",colnames(y6t1data[,75:358]), sep = "_")