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
+8-23Lines changed: 8 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -43,36 +43,21 @@ To illustrate how to use the method available with real life examples, let's sim
43
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***.
44
44
45
45
```{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"
66
53
)
67
-
68
-
Products
69
54
```
70
55
71
56
2. Defining a `data.table` showing the proportion of taxes to be applied for processed products based on their units.
0 commit comments