title: How to change few column names in a data table
body: <p>I have a data table with 10 columns. </p>
  
  <pre><code>town    
  tc  
  one  
  two  
  three   
  four    
  five    
  six  
  seven   
  total
  </code></pre>
  
  <p>Need to generate mean for columns "one" to "total" for which I am using,</p>
  
  <pre><code>DTmean &lt;- DT[,(lapply(.SD,mean)),by = .(town,tc),.SDcols=3:10]
  </code></pre>
  
  <p>This generates the mean, but then I want the column names to be suffixed with "_mean". How can we do this? Want the first two columns to remain the same as "town" and "tc". I tried the below but then it renames all "one" to "total" to just "_mean"</p>
  
  <pre><code>for (i in 3:10) {
    setnames(DTmean,i,paste0(names(i),"_mean"))
  }
  </code></pre>