What is the best data.table way of doing something similar to UPDATE FROM in SQL?
I used to do something like dta = data.table(idx = c(1, 2, 3), a = runif(3), key = "idx") dtb = data.table(idx = c(1, 3), b = runif(3), key = "idx") dta[dtb, b := b] However, after the 1.9.3 and the explicit .EACHI, it fails sometimes, but I can't determine when. So, just to be sure, I do dta[dtb, b := b, .EACHI = TRUE, nomatch = 0] Is the .EACHI and the nomatch necessary? In this case, I want the row with idx 1 and 3 (the matching ones) to end with a b value from the matching b column in dtb, and the row with idx 2 (the one that isn't in dtb) to end up with NA in column b.
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
