I have a data.frame (or a matrix or any other tabular data structure object for that matter):
df = data.frame(field1 = c(1,1,1),field2 = c(2,2,2),field3 = c(
You can use cbind:
cbind
cbind(dt, df[fields])
However, the most efficient way is still probably going to be to use data.table's assign by reference:
data.table
dt[, (fields) := df[fields]]