title: R - How to convert string to variable name
body: <p>I have used 'assign' to create a number of variables and assigned to them values:</p>
  
  <pre><code>N &lt;- 10
  for(i in 1:N)
  {
      #create variable names n1, ..., n'N'
      assign(paste0("name",i), data.frame(matrix(1:100, ncol=3, nrow=100)))
  }
  </code></pre>
  
  <p>I now need to be able to access these variable names, but NOT assign anything to them; I need to just change their column headers (in this application).  The following code doesn't work, but something like this:</p>
  
  <pre><code>for(i in 1:N)
  {
      #create proper column headers
      colnames(assign(paste0("name",i), ???) &lt;- c("a","b","c")
  }
  </code></pre>
  
  <p>I would like to know what to put in place of "???" or to learn of a different approach.</p>
  
  <p>There are other applications that would also not involve assigning anything to the variables.</p>