title: melt dataframe - multiple columns - "Enhanced (new) functionality from data.tables"
body: <p>Update:  I should have been clearer that I was trying to check out the Enhanced functionality in reshaping using data.tables <a href="https://cran.r-project.org/web/packages/data.table/vignettes/datatable-reshape.html" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/data.table/vignettes/datatable-reshape.html</a>. Updated the title. </p>
  
  <p>I have this data set with two sets of variables - Credit_Risk_Capital and Name_concentration. They are calculated per 2 methodologies - New and Old. When I melt them using the data.table package, the variable names default to 1 and 2. How can I change them to just Credit_Risk_Capital and Name_Concentration.</p>
  
  <p>Here is the data set</p>
  
  <pre><code>    df &lt;-data.table (id = c(1:100),Credit_risk_Capital_old= rnorm(100, mean = 400, sd = 60),
               NameConcentration_old= rnorm(100, mean = 100, sd = 10),
               Credit_risk_Capital_New =rnorm(100, mean = 200, sd = 10),
               NameConcentration_New = rnorm(100, mean = 40, sd = 10))
      old &lt;- c('Credit_risk_Capital_old','NameConcentration_old')
     new&lt;-c('Credit_risk_Capital_New','NameConcentration_New')
    t1&lt;-melt(df, measure.vars = list(old,new), variable.name = "CapitalChargeType",value.name = c("old","new"))
  </code></pre>
  
  <p>Now instead of the elements in the CapitalChargeType Column getting tagged as 1's and 2's, I want them to be changed to Credit_risk_Capital and NameConcentration. I can obviously change them in a subsequent step using a 'match' function, but is there anyway I can do it within melt itself. </p>