I have the following data.table
data.table
x = structure(list(f1 = 1:3, f2 = 3:5), .Names = c(\"f1\", \"f2\"), row.names = c(NA, -3L), class = c(\"data.tab
The most elegant way I've found is with mapply:
mapply
x[, value := mapply(func.text, f1, f2)] x # f1 f2 value # 1: 1 3 21.08554 # 2: 2 4 56.59815 # 3: 3 5 151.4132
Or with the purrr package:
purrr
x[, value := purrr::pmap(.(f1, f2), func.text)]