BioChemoinformatics
BioChemoinformatics

Reputation: 715

R: Speed up combine(paste or paste0) operation for 39 millions rows and two columns in data.table

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

Answers (1)

BioChemoinformatics
BioChemoinformatics

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

Related Questions