Skip to content

Commit

Permalink
rebase from master
Browse files Browse the repository at this point in the history
  • Loading branch information
rikivillalba committed Nov 23, 2024
1 parent 546259d commit 7c661b4
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 38 deletions.
25 changes: 25 additions & 0 deletions vignettes/_translation_links.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build a link list of alternative languages (may be character(0))
.write.translation.links <- function(fmt) {
url = "https://rdatatable.gitlab.io/data.table/articles"
path = dirname(knitr::current_input(TRUE))
if (basename(path) == "vignettes") {
lang = "en"
} else {
lang = basename(path)
path = dirname(path)
}
translation = dir(path,
recursive = TRUE,
pattern = glob2rx(knitr::current_input(FALSE))
)
transl_lang = ifelse(dirname(translation) == ".", "en", dirname(translation))
block = if (length(which(transl_lang != lang))) {
sprintf(
fmt, paste(collapse = " | ", sprintf(
"[%s](%s)",
transl_lang[transl_lang != lang],
file.path(url, sub("(?i)\\.Rmd$", ".html", translation[transl_lang != lang]))
)))
} else ""
knitr::asis_output(block)
}
6 changes: 3 additions & 3 deletions vignettes/datatable-benchmarking.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ h2 {
}
</style>

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-benchmarking.html)
```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This document is meant to guide on measuring performance of `data.table`. Single place to document best practices and traps to avoid.

Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-faq.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ h2 {
}
</style>

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-faq.html)

```{r, echo = FALSE, message = FALSE}
library(data.table)
knitr::opts_chunk$set(
Expand All @@ -41,6 +37,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

The first section, Beginner FAQs, is intended to be read in order, from start to finish. It's just written in a FAQ style to be digested more easily. It isn't really the most frequently asked questions. A better measure for that is looking on Stack Overflow.

This FAQ is required reading and considered core documentation. Please do not ask questions on Stack Overflow or raise issues on GitHub until you have read it. We can all tell when you ask that you haven't read it. So if you do ask and haven't read it, don't use your real name.
Expand Down
6 changes: 3 additions & 3 deletions vignettes/datatable-importing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ h2 {
}
</style>

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-importing.html)
```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This document is focused on using `data.table` as a dependency in other R packages. If you are interested in using `data.table` C code from a non-R application, or in calling its C functions directly, jump to the [last section](#non-r-api) of this vignette.

Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-intro.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -25,6 +21,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette introduces the `data.table` syntax, its general form, how to *subset* rows, *select and compute* on columns, and perform aggregations *by group*. Familiarity with the `data.frame` data structure from base R is useful, but not essential to follow this vignette.

***
Expand Down
4 changes: 4 additions & 0 deletions vignettes/datatable-joins.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ knitr::opts_chunk$set(
)
```

```{r, echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

In this vignette you will learn how to perform any join operation using resources available in the `data.table` syntax.

It assumes familiarity with the `data.table` syntax. If that is not the case, please read the following vignettes:
Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-keys-fast-subset.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-keys-fast-subset.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -24,6 +20,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette is aimed at those who are already familiar with *data.table* syntax, its general form, how to subset rows in `i`, select and compute on columns, add/modify/delete columns *by reference* in `j` and group by using `by`. If you're not familiar with these concepts, please read the vignettes [`vignette("datatable-intro", package="data.table")`](datatable-intro.html) and [`vignette("datatable-reference-semantics", package="data.table")`](datatable-reference-semantics.html) first.

***
Expand Down
7 changes: 3 additions & 4 deletions vignettes/datatable-programming.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-programming.html)

```{r init, include = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -24,6 +20,9 @@ knitr::opts_chunk$set(
)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

## Introduction

Expand Down
9 changes: 5 additions & 4 deletions vignettes/datatable-reference-semantics.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-reference-semantics.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -23,6 +19,11 @@ knitr::opts_chunk$set(
collapse = TRUE)
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette discusses *data.table*'s reference semantics which allows to *add/update/delete* columns of a *data.table by reference*, and also combine them with `i` and `by`. It is aimed at those who are already familiar with *data.table* syntax, its general form, how to subset rows in `i`, select and compute on columns, and perform aggregations by group. If you're not familiar with these concepts, please read the [`vignette("datatable-intro", package="data.table")`](datatable-intro.html) vignette first.

***
Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-reshape.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-reshape.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -24,6 +20,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette discusses the default usage of reshaping functions `melt` (wide to long) and `dcast` (long to wide) for *data.tables* as well as the **new extended functionalities** of melting and casting on *multiple columns* available from `v1.9.6`.

***
Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-sd-usage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ vignette: >
}
</style>

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-sd-usage.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -39,6 +35,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette will explain the most common ways to use the `.SD` variable in your `data.table` analyses. It is an adaptation of [this answer](https://stackoverflow.com/a/47406952/3576984) given on StackOverflow.

# What is `.SD`?
Expand Down
8 changes: 4 additions & 4 deletions vignettes/datatable-secondary-indices-and-auto-indexing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vignette: >
\usepackage[utf8]{inputenc}
---

Translations of this document are available in

* [French](https://rdatatable.gitlab.io/data.table/articles/fr/datatable-secondary-indices-and-auto-indexing.html)

```{r, echo = FALSE, message = FALSE}
require(data.table)
knitr::opts_chunk$set(
Expand All @@ -24,6 +20,10 @@ knitr::opts_chunk$set(
.old.th = setDTthreads(1)
```

```{r echo=FALSE, file='_translation_links.R'}
```
`r .write.translation.links("Translations of this document are available in: %s")`

This vignette assumes that the reader is familiar with data.table's `[i, j, by]` syntax, and how to perform fast key based subsets. If you're not familiar with these concepts, please read the [`vignette("datatable-intro", package="data.table")`](datatable-intro.html), [`vignette("datatable-reference-semantics", package="data.table")`](datatable-reference-semantics.html), and [`vignette("datatable-keys-fast-subset", package="data.table")`](datatable-keys-fast-subset.html) vignettes first.

***
Expand Down

0 comments on commit 7c661b4

Please sign in to comment.