I have a large data frame in which I am multiplying two columns together to get another column. At first I was running a for-loop, like so:
for(i in 1:nrow(d
A data.table solution will avoid lots of internal copying while having the advantages of not spattering the code with $.
$
library(data.table) DT <- data.table(df) DT[ , new := column1 * column2]