Reputation: 715
I have a DT (data.table), which include 39-million rows and two columns, for exmaple cola
and colb
, and I want to add a new column named colc
, which is DT[,
:=(colc = paste(cola, colb, sep="-"))
, but the speed is a little slow.
Do you have an alternative way to speed up this operation?
Upvotes: 2
Views: 1769
Reputation: 715
As @Frank suggested, using by = 'cola,colb'
, my original problem can be solved in this way and do not need add the additional column.
Upvotes: 2