title: Changing column names of many dataframes in a loop
body: <p>I have three dataframes EC_Data, ED_Data, and ST_data
  all of them have the same column names and more specifically, after 4th column
  has Year named colums from 2006 to 2015</p>
  <p>So I create a new list that has all three dataframes:</p>
  <pre><code>Alldata = list(EC_Data, ED_Data, ST_Data)
  </code></pre>
  <p>So I tried to rename all the columns in a for loop like below...</p>
  <pre><code>for(x in seq_along(Alldata))
  {
    for(j in seq_along(Alldata[[x]]))
    {
      if(j&gt;4)
      {
        names(colnames(Alldata[[x]][j])) &lt;- paste(&quot;X&quot;, substr(colnames(Alldata[[x]][j]), start = 1, stop = 5),sep=&quot;&quot;)
        print(colnames(Alldata[[x]][j]))
      }
    }
  }
  </code></pre>
  <p>But nothing happens...</p>
  <p>I cannot understand why, because when I try to call the names of every list, for example  with</p>
  <pre><code>view(colnames(Alldata[[2]])) 
  </code></pre>
  <p>the names seems to be exactly what I want to see</p>
  <p>Can someone help me to understand the reason that this loop doesn't work and what can I use instead of this?</p>
  <p>Thank you</p>