I want to change the colnames of my dataframe "pre_sub" within a loop. Therefore I need to get access to different columns in my dataframe, which I address with various loop indices (i, j,k) This is what I have so far:
colnames(as.name(paste("pre_sub$",variable[i], a_parse[k], sep=""))) <- paste(variable_new[i], frame_name[j], a_parse[k], sep="")
My problem is that the as.name function now gives me my pasted name in backticks, like so
"backtick" + pre_sub$VA14 + "backtick" (I can't use backticks, as the text is than transformed to code)
And therefore the colname-function doesn't work.
This only appears when I include the "$" sign in my paste function. Do you know how I can get the name of my dataframe-columns without the backticks?
Thanks!