title: In loop, use {i} as text, or change columns names in a loop/lapply
body: <p>I need to change the columns names for several dataframes that have the same name structure. I would like to use a loop, but I keep having the same problems. So I am open to use lapply or whatever:</p>
  
  <p>This is what I want:</p>
  
  <pre><code>colnames(gom2)&lt;-c(paste("d2", colnames(gom2),sep="_"))
  colnames(gom3)&lt;-c(paste("d3", colnames(gom3),sep="_"))
  colnames(gom4)&lt;-c(paste("d4", colnames(gom4),sep="_"))
  colnames(gom5)&lt;-c(paste("d5", colnames(gom5),sep="_"))
  colnames(gom6)&lt;-c(paste("d6", colnames(gom6),sep="_"))
  </code></pre>
  
  <p>This is my attempt:</p>
  
  <pre><code> for (i in 2:6){
      colnames(gom{i})&lt;-c(paste("d{i}", colnames(gom{i}), sep="_")
      }
  </code></pre>
  
  <p>I know this code is mistaken but I just can't get the {i} as text to work with it. I am open to any solution using anything as long as it is intuitive. I have seen other solutions, and tried, but have not had much success, and can't understand what they are doing.
  Thanks!</p>