Skip to content

Commit 5a3f19c

Browse files
committed
updated
1 parent ff365ac commit 5a3f19c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

vignettes/datatable-joins.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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}
728728
data.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}
734734
cols <- setdiff(names(Products), "id")
735735
ProductPriceHistory[, (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**
742742
To dynamically update columns and handle missing values:

0 commit comments

Comments
 (0)