@@ -710,7 +710,7 @@ Products[ProductPriceHistory,
710710 on = .(id = product_id),
711711 price := i.price]
712712```
713- - i.price refers to price from i (ProductPriceHistory).
713+ - ` i.price ` refers to price from ` i ` ` (ProductPriceHistory) ` .
714714- Modifies Products in-place.
715715
716716** Grouped Updates with ` .EACHI ` **
@@ -721,22 +721,22 @@ Products[ProductPriceHistory,
721721 `:=`(price = last(i.price), last_updated = last(i.date)),
722722 by = .EACHI]
723723```
724- - by = .EACHI groups by i's rows (1 group per Products row).
725- - last() returns last value including NA :
724+ - ` by = .EACHI ` groups by i's rows (1 group per Products row).
725+ - ` last() ` returns last value including ` NA ` :
726726
727727``` {r}
728728data.table::last(c(1, NA)) # NA
729729```
730730** Efficient Right Join Update**
731- Add product details to ProductPriceHistory without copying:
731+ Add product details to ` ProductPriceHistory ` without copying:
732732
733733``` {r}
734734cols <- setdiff(names(Products), "id")
735735ProductPriceHistory[, (cols) :=
736736 Products[.SD, on = .(id = product_id), .SD, .SDcols = cols]]
737737```
738- - .SD refers to ProductPriceHistory during the join.
739- - Updates ProductPriceHistory by reference.
738+ - ` .SD ` refers to ` ProductPriceHistory ` during the join.
739+ - Updates ` ProductPriceHistory ` by reference.
740740
741741** Handling Edge Cases and Dynamic Column Updates**
742742To dynamically update columns and handle missing values:
0 commit comments