title: reshape wide to long using data.table with multiple columns
body: <p>I have a dataframe in a wide format, like below.  i want to reshape the wide to long using data.table melt function.in simple case, i can split two data, and rbind two datasets. but in my case, there are multiple test(i) testgr(i) columns.  But there must be a better and a more efficient way to do this. thx in advance.</p>
  
  <p>from =></p>
  
  <pre><code>id&lt;-c("106E1258","106E2037","104E1182","105E1248","105E1470","10241247",
  "10241703")
  yr&lt;-c(2017,2017,2015,2016,2016,2013,2013)
  finalgr&lt;-c(72,76,75,71,75,77,78)
  test01&lt;-c("R0560","R0066","R0308","R0129","R0354","R0483",  
  "R0503")
  test01gr&lt;-c(73,74,67,80,64,80,70)
  test02&lt;-c("R0660","R0266","R0302","R0139","R0324","R0383"   ,
  "R0503")
  test02gr&lt;-c(71,54,67,70,68,81,61)
  dt&lt;-data.frame(id=id,yr=yr,
  finalgr=finalgr,
  test01=test01,test01gr=test01gr,
  test02=test02,test02gr=test02gr)
  </code></pre>
  
  <p>to=></p>
  
  <pre><code>id2&lt;-c("106E1258","106E1258","104E1182","104E1182")
  yr2&lt;-c(2017,2017,2015,2015)
  finalgr&lt;-c(72,72,75,75)
  testid&lt;-c("R0560","R0660","R0308","R0302")
  testgr&lt;-c(73,71,67,67)
  dt2&lt;-data.frame(id=id2,yr=yr2,finalgr=finalgr,testid=testid,testgr=testgr)
  </code></pre>