Skip to content

Commit 9133ac6

Browse files
committed
vignettes: avoid using _ or . in header IDs
data.table-intro on CRAN: <h3 id="h-great-but-how-can-i-refer-to-columns-by-names-in-j-like-in-a-data-frame" #refer_j>h) Great! But how can I refer to columns by names in <code>j</code> (like in a <code>data.frame</code>)?</h3> <h4 id="how-can-we-calculate-the-number-of-trips-for-each-origin-airport-for-carrier-code-quot-aa-quot" #origin-.N>– How can we calculate the number of trips for each origin airport for carrier code <code>&quot;AA&quot;</code>?</h4> <h4 id="how-can-we-get-the-total-number-of-trips-for-each-origin-dest-pair-for-carrier-code-quot-aa-quot" #origin-dest-.N>– How can we get the total number of trips for each <code>origin, dest</code> pair for carrier code <code>&quot;AA&quot;</code>?</h4> This is not valid HTML and the links to these headers don't work. "Intro" seems to be the only vignette affected.
1 parent 32dfd8d commit 9133ac6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

vignettes/datatable-intro.Rmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ ans
316316

317317
We could have accomplished the same operation by doing `nrow(flights[origin == "JFK" & month == 6L])`. However, it would have to subset the entire `data.table` first corresponding to the *row indices* in `i` *and then* return the rows using `nrow()`, which is unnecessary and inefficient. We will cover this and other optimisation aspects in detail under the *`data.table` design* vignette.
318318

319-
### h) Great! But how can I refer to columns by names in `j` (like in a `data.frame`)? {#refer_j}
319+
### h) Great! But how can I refer to columns by names in `j` (like in a `data.frame`)? {#refer-j}
320320

321321
If you're writing out the column names explicitly, there's no difference compared to a `data.frame` (since v1.9.8).
322322

@@ -422,7 +422,7 @@ ans
422422
423423
We'll use this convenient form wherever applicable hereafter.
424424
425-
#### -- How can we calculate the number of trips for each origin airport for carrier code `"AA"`? {#origin-.N}
425+
#### -- How can we calculate the number of trips for each origin airport for carrier code `"AA"`? {#origin-N}
426426
427427
The unique carrier code `"AA"` corresponds to *American Airlines Inc.*
428428
@@ -435,7 +435,7 @@ ans
435435

436436
* Using those *row indices*, we obtain the number of rows while grouped by `origin`. Once again no columns are actually materialised here, because the `j-expression` does not require any columns to be actually subsetted and is therefore fast and memory efficient.
437437

438-
#### -- How can we get the total number of trips for each `origin, dest` pair for carrier code `"AA"`? {#origin-dest-.N}
438+
#### -- How can we get the total number of trips for each `origin, dest` pair for carrier code `"AA"`? {#origin-dest-N}
439439

440440
```{r}
441441
ans <- flights[carrier == "AA", .N, by = .(origin, dest)]
@@ -483,7 +483,7 @@ We'll learn more about `keys` in the [`vignette("datatable-keys-fast-subset", pa
483483

484484
### c) Chaining
485485

486-
Let's reconsider the task of [getting the total number of trips for each `origin, dest` pair for carrier *"AA"*](#origin-dest-.N).
486+
Let's reconsider the task of [getting the total number of trips for each `origin, dest` pair for carrier *"AA"*](#origin-dest-N).
487487

488488
```{r}
489489
ans <- flights[carrier == "AA", .N, by = .(origin, dest)]
@@ -583,7 +583,7 @@ We are almost there. There is one little thing left to address. In our `flights`
583583

584584
Using the argument `.SDcols`. It accepts either column names or column indices. For example, `.SDcols = c("arr_delay", "dep_delay")` ensures that `.SD` contains only these two columns for each group.
585585

586-
Similar to [part g)](#refer_j), you can also specify the columns to remove instead of columns to keep using `-` or `!`. Additionally, you can select consecutive columns as `colA:colB` and deselect them as `!(colA:colB)` or `-(colA:colB)`.
586+
Similar to [part g)](#refer-j), you can also specify the columns to remove instead of columns to keep using `-` or `!`. Additionally, you can select consecutive columns as `colA:colB` and deselect them as `!(colA:colB)` or `-(colA:colB)`.
587587

588588
Now let us try to use `.SD` along with `.SDcols` to get the `mean()` of `arr_delay` and `dep_delay` columns grouped by `origin`, `dest` and `month`.
589589

0 commit comments

Comments
 (0)