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
Copy file name to clipboardExpand all lines: vignettes/datatable-joins.Rmd
+21-23Lines changed: 21 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -38,11 +38,11 @@ It assumes familiarity with the `data.table` syntax. If that is not the case, pl
38
38
39
39
## 1. Defining example data
40
40
41
-
To illustrate how to use the method available with real life examples, let's simulate a **normalized database** from a little supermarket by performing the following steps:
41
+
To illustrate how to use the method available with real life examples, let's simulate a **normalized database** from a little supermarket by defining the following tables in a database:
42
42
43
-
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***.
43
+
1.`Products`, a table with rows giving characteristics of various products. To show how the framework deals with ***missing values***, one `id` is `NA`.
44
44
45
-
```{r}
45
+
```{r, define_products}
46
46
Products = rowwiseDT(
47
47
id=, name=, price=, unit=, type=,
48
48
1L, "banana", 0.63, "unit", "natural",
@@ -53,9 +53,9 @@ Products = rowwiseDT(
53
53
)
54
54
```
55
55
56
-
2.Defining a `data.table` showing the proportion of taxes to be applied for processed products based on their units.
56
+
2.`NewTax`, a table with rows defining some taxes associated with processed products based on their units.
57
57
58
-
```{r}
58
+
```{r define_new_tax}
59
59
NewTax = data.table(
60
60
unit = c("unit", "ounce"),
61
61
type = "processed",
@@ -66,38 +66,36 @@ NewTax
66
66
```
67
67
68
68
69
-
3.Defining a `data.table` simulating the products received every Monday with a `product_id` that is not present in the `Products` table.
69
+
3.`ProductReceived`, a tablewith rows simulating weekly incoming inventory.
0 commit comments