title: Using loop variables
body: <p>I would like to rename a large number of columns (column headers) to have numerical names rather than combined letter+number names. Because of the way the data is stored in raw format, I cannot just access the correct column numbers by using <code>data[[152]]</code> if I want to interact with a specific column of data (because random questions are filtered completely out of the data due to being long answer comments), but I'd like to be able to access them by <code>data$152</code>. Additionally, approximately half the columns names in my data have loaded with <code>class(data$152)</code> = NULL but <code>class(data[[152]])</code> = integer (and if I rename the <code>data[[152]]</code> file it appropriately allows me to see <code>class(data$152)</code> as integer).</p>
  
  <p>Thus, is there a way to use the loop iteration number as a column name (something like below)</p>
  
  <pre><code>    for (n in 1:415) {
          names(data)[n] &lt;-"n"    # name nth column after number 'n'
      }
  </code></pre>
  
  <p>That will reassign all my column headers and ensure that I do not run into question classes resulting in null?</p>
  
  <p>As additional background info, my data is imported from a comma delimited .csv file with the value 99 assigned to answers of NA with the first row being the column names/headers</p>
  
  <pre><code>    data &lt;- read.table("rawdata.csv", header=TRUE, sep=",", na.strings = "99")
  </code></pre>
  
  <p>There are 415 columns with headers in format Q001, Q002, etc
  There are approximately 200 rows with no row labels/no label column</p>