Hey Petr, thanks for answering. First to your question: I use rename from the reshape package. You are probably right to assume that I do not have a to extensive reading background in R - basically I had to dive right in (which probably isn't a good idea, but I could not change that). Having a solid background in other statistics packages (stata, SPSS) I now find myself putting quite a lot of effort into presumably easy to do things like recoding, merging, looping etc. (I really dont want to mention how long it took me to get that recode done in the first place ...). So in any case I am sorry if I am bothering you with somewhat strange problems...
Nevertehless even though your proposed solution did work 'as is' it did not when I remodelled it to my data vec<-paste0("y", 1:5) ti[grep("y",vec)]<- paste0("tiy", 1:5) It did produce no error message but the variable names did not change. Could the problem be that ti in my case is not a vector but a dataframe (the y's being variables in that dataframe?) All the best Bernhard -- View this message in context: http://r.789695.n4.nabble.com/Loop-over-several-Variables-add-on-question-tp4648216p4648225.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.