Skip to content

Commit d01e83c

Browse files
committed
Fix remaining r ... expressions
1 parent 010c238 commit d01e83c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

vignettes/datatable-intro.Rmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,11 @@ DT[, print(c(a,b)), by = ID] # (1)
635635
DT[, print(list(c(a,b))), by = ID] # (2)
636636
```
637637

638-
In (1), for each group, a vector is returned, with length = 6,4,2 here. However, (2) returns a list of length 1 for each group, with its first element holding vectors of length 6,4,2. Therefore, (1) results in a length of ` 6+4+2 = `r 6+4+2``, whereas (2) returns `1+1+1=`r 1+1+1``.
638+
```{r, echo = FALSE}
639+
p = function(x) paste0('<code>', paste(deparse(substitute(x)), collapse = ' '), ' = ', x, '</code>')
640+
```
641+
642+
In (1), for each group, a vector is returned, with length = 6,4,2 here. However, (2) returns a list of length 1 for each group, with its first element holding vectors of length 6,4,2. Therefore, (1) results in a length of `{r} p(6+4+2)`, whereas (2) returns `{r} p(1+1+1)`.
639643

640644
Flexibility of j allows us to store any list object as an element of data.table. For example, when statistical models are fit to groups, these models can be stored in a data.table. Code is concise and easy to understand.
641645

vignettes/datatable-keys-fast-subset.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ dim(ans2)
441441
identical(ans1$val, ans2$val)
442442
```
443443

444-
* The speed-up is **~`r round(t1[3]/max(t2[3], .001))`x**!
444+
* The speed-up is **~`{r} round(t1[3]/max(t2[3], .001))`x**!
445445

446446
### b) Why does keying a *data.table* result in blazing fast subsets?
447447

0 commit comments

Comments
 (0)