Skip to content

Commit e4dd90e

Browse files
Use rowwiseDT in vignette construction
1 parent e1409e8 commit e4dd90e

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

vignettes/datatable-joins.Rmd

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,13 @@ To illustrate how to use the method available with real life examples, let's sim
4343
1. Defining a `data.table` where each product is represented by a row with some qualities, but leaving one product without `id` to show how the framework deals with ***missing values***.
4444

4545
```{r}
46-
Products = data.table(
47-
id = c(1:4,
48-
NA_integer_),
49-
name = c("banana",
50-
"carrots",
51-
"popcorn",
52-
"soda",
53-
"toothpaste"),
54-
price = c(0.63,
55-
0.89,
56-
2.99,
57-
1.49,
58-
2.99),
59-
unit = c("unit",
60-
"lb",
61-
"unit",
62-
"ounce",
63-
"unit"),
64-
type = c(rep("natural", 2L),
65-
rep("processed", 3L))
46+
Products = rowwiseDT(
47+
id=, name=, price=, unit=, type=,
48+
1L, "banana", 0.63, "unit", "natural",
49+
2L, "carrots", 0.89, "lb", "natural",
50+
3L, "popcorn", 2.99, "unit", "processed",
51+
4L, "soda", 1.49, "ounce", "processed",
52+
NA, "toothpaste", 2.99, "unit", "processed"
6653
)
6754
6855
Products
@@ -72,7 +59,7 @@ Products
7259

7360
```{r}
7461
NewTax = data.table(
75-
unit = c("unit","ounce"),
62+
unit = c("unit", "ounce"),
7663
type = "processed",
7764
tax_prop = c(0.65, 0.20)
7865
)

0 commit comments

Comments
 (0)