Skip to content

Commit 52bcf66

Browse files
Merge branch 'master' into join-vig-clarity
2 parents ddc4207 + dd94b92 commit 52bcf66

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

vignettes/datatable-joins.Rmd

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,22 @@ To illustrate how to use the method available with real life examples, let's sim
4242

4343
1. `Products`, a table with rows giving characteristics of various products. To show how the framework deals with ***missing values***, one `id` is `NA`.
4444

45-
```{r define_products}
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))
45+
```{r, define_products}
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
)
67-
68-
Products
6954
```
7055

7156
2. `NewTax`, a table with rows defining some taxes associated with processed products based on their units.
7257

7358
```{r define_new_tax}
7459
NewTax = data.table(
75-
unit = c("unit","ounce"),
60+
unit = c("unit", "ounce"),
7661
type = "processed",
7762
tax_prop = c(0.65, 0.20)
7863
)

0 commit comments

Comments
 (0)