You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Products[ProductPriceHistory, on = .(id = product_id), (col) := get(paste0("i.", col))]}
767
+
Products[ProductPriceHistory,
768
+
on = .(id = product_id),
769
+
(col) := i[[col]],
770
+
env = list(col = col)]}
767
771
```
768
772
- Ensures multiple columns are updated efficiently in a loop.
769
773
770
774
**Summary**
771
775
- `last(x)` vs `tail(x,1)`: Both return last element, but `tail()` returns list for lists.
772
776
- `:=` always modifies `x`, never `i`. For right joins, update `i` directly via `i[, ... := x[.SD]]`.
773
777
- `.EACHI` is crucial for per-row operations; simple joins use first match.
774
-
778
+
- Note: Older functions like `mapvalues()` from the deprecated `plyr` package were previously used for recoding values. It is recommended to use data.table’s native update-join methods for efficient and future-proof code.
0 commit comments