From 96f9e7bb6adca7379dda32efe3bde25f9b6fdd11 Mon Sep 17 00:00:00 2001 From: vincentarelbundock Date: Mon, 4 Nov 2024 22:08:11 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20vincenta?= =?UTF-8?q?relbundock/tinytable@9cd7c84c0e4953280c6e61b3a11c34a3b5fac81b?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.html | 4 + LICENSE.html | 4 + NEWS.html | 4 + index.html | 4 + man/format_tt.html | 134 +- man/group_tt.html | 198 +-- man/plot_tt.html | 4 + man/print.tinytable.html | 4 + man/rbind2-tinytable-tinytable-method.html | 76 +- man/save_tt.html | 4 + man/style_tt.html | 4 + man/theme_tt.html | 48 +- man/tinytable-package.html | 4 + man/tt.html | 80 +- quarto_website.yml | 1 + search.json | 667 +++++----- vignettes/alternatives.html | 4 + vignettes/custom.html | 124 +- vignettes/faq.html | 100 +- vignettes/format.html | 380 +++--- vignettes/group.html | 306 ++--- vignettes/notebooks.html | 1075 +++++++++++++++++ vignettes/options.html | 4 + vignettes/plot.html | 200 +-- vignettes/style.html | 824 ++++++------- vignettes/theme.html | 112 +- vignettes/tinytable.html | 360 +++--- .../id3xqz5pgd34z2msewx5au.png | Bin 0 -> 2444 bytes .../id57a68quw6an3v0x76i6l.png | Bin 0 -> 11898 bytes .../id5vyxtoiljpjxohxrubhj.png | Bin 0 -> 11338 bytes .../id8qmipy2c9p31fbxmig1l.png | Bin 0 -> 11877 bytes .../id99kb1qxf9c7g3v1do24y.png | Bin 0 -> 1127 bytes .../id99z0tnbfbwc8fv6yjpq8.png | Bin 0 -> 1829 bytes .../id9gcd3saw5mol96g7svyz.png | Bin 0 -> 5073 bytes .../idapfw6ev8ftqbbsqhl2md.png | Bin 0 -> 8399 bytes .../idfk5la8497w3bkqrxwaiq.png | Bin 0 -> 10991 bytes .../idh98eii2q0h69ow7zlaim.png | Bin 0 -> 2191 bytes .../idhrj6n1jcrk7mcxvhvcrj.png | Bin 0 -> 5080 bytes .../idiesv94816ixljv5392s9.png | Bin 0 -> 548 bytes .../idmni6pbnu10a03zggsa21.png | Bin 0 -> 2077 bytes .../idnbp5kitlkwd5ba0kvc14.png | Bin 0 -> 2564 bytes .../idnwf16cxpwrnkvafysdj9.png | Bin 0 -> 2214 bytes .../idrfowdwast5hu7nnxch46.png | Bin 0 -> 12175 bytes .../idsaaa6nib46sr6nmyy3dy.png | Bin 0 -> 2558 bytes .../idshl4x9r07tc61vux7znr.png | Bin 0 -> 1728 bytes .../idt9hn7lzzks5s6ynfoeuz.png | Bin 0 -> 2250 bytes .../idvdzz6gihh15nsn18jvqq.png | Bin 0 -> 1846 bytes .../idvl04dksh9tcamy2p0hqj.png | Bin 0 -> 5057 bytes .../idvn2vqc3u69ongsgfky0v.png | Bin 0 -> 512 bytes .../idwbx48mp6i6fkiux7nima.png | Bin 0 -> 2072 bytes .../idwiqrj22a7zm7i1g3sz13.png | Bin 0 -> 529 bytes .../idwu25b4fd3lf2vcn9swpc.png | Bin 0 -> 15240 bytes .../idx9wvjlivyuapicycanl6.png | Bin 0 -> 11912 bytes .../idzs31h051u5em6413l29f.png | Bin 0 -> 10726 bytes vignettes/tinytable_tutorial.pdf | Bin 1802881 -> 1802829 bytes 55 files changed, 2907 insertions(+), 1822 deletions(-) create mode 100644 vignettes/notebooks.html create mode 100644 vignettes/tinytable_assets/id3xqz5pgd34z2msewx5au.png create mode 100644 vignettes/tinytable_assets/id57a68quw6an3v0x76i6l.png create mode 100644 vignettes/tinytable_assets/id5vyxtoiljpjxohxrubhj.png create mode 100644 vignettes/tinytable_assets/id8qmipy2c9p31fbxmig1l.png create mode 100644 vignettes/tinytable_assets/id99kb1qxf9c7g3v1do24y.png create mode 100644 vignettes/tinytable_assets/id99z0tnbfbwc8fv6yjpq8.png create mode 100644 vignettes/tinytable_assets/id9gcd3saw5mol96g7svyz.png create mode 100644 vignettes/tinytable_assets/idapfw6ev8ftqbbsqhl2md.png create mode 100644 vignettes/tinytable_assets/idfk5la8497w3bkqrxwaiq.png create mode 100644 vignettes/tinytable_assets/idh98eii2q0h69ow7zlaim.png create mode 100644 vignettes/tinytable_assets/idhrj6n1jcrk7mcxvhvcrj.png create mode 100644 vignettes/tinytable_assets/idiesv94816ixljv5392s9.png create mode 100644 vignettes/tinytable_assets/idmni6pbnu10a03zggsa21.png create mode 100644 vignettes/tinytable_assets/idnbp5kitlkwd5ba0kvc14.png create mode 100644 vignettes/tinytable_assets/idnwf16cxpwrnkvafysdj9.png create mode 100644 vignettes/tinytable_assets/idrfowdwast5hu7nnxch46.png create mode 100644 vignettes/tinytable_assets/idsaaa6nib46sr6nmyy3dy.png create mode 100644 vignettes/tinytable_assets/idshl4x9r07tc61vux7znr.png create mode 100644 vignettes/tinytable_assets/idt9hn7lzzks5s6ynfoeuz.png create mode 100644 vignettes/tinytable_assets/idvdzz6gihh15nsn18jvqq.png create mode 100644 vignettes/tinytable_assets/idvl04dksh9tcamy2p0hqj.png create mode 100644 vignettes/tinytable_assets/idvn2vqc3u69ongsgfky0v.png create mode 100644 vignettes/tinytable_assets/idwbx48mp6i6fkiux7nima.png create mode 100644 vignettes/tinytable_assets/idwiqrj22a7zm7i1g3sz13.png create mode 100644 vignettes/tinytable_assets/idwu25b4fd3lf2vcn9swpc.png create mode 100644 vignettes/tinytable_assets/idx9wvjlivyuapicycanl6.png create mode 100644 vignettes/tinytable_assets/idzs31h051u5em6413l29f.png diff --git a/CITATION.html b/CITATION.html index c9cf57c0..7ad6ac32 100644 --- a/CITATION.html +++ b/CITATION.html @@ -128,6 +128,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • diff --git a/LICENSE.html b/LICENSE.html index 94ceceda..23b1e3f6 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -129,6 +129,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • diff --git a/NEWS.html b/NEWS.html index 0d9f1890..b05d0bae 100644 --- a/NEWS.html +++ b/NEWS.html @@ -158,6 +158,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • diff --git a/index.html b/index.html index 1e59e651..63248d82 100644 --- a/index.html +++ b/index.html @@ -161,6 +161,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • diff --git a/man/format_tt.html b/man/format_tt.html index 8e9d7328..d3744bc0 100644 --- a/man/format_tt.html +++ b/man/format_tt.html @@ -163,6 +163,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • @@ -724,8 +728,8 @@

    Examples

    + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + +
    + + +
    + + + +
    + + + + +
    +

    Notebooks (Quarto, Rmarkdown, Bookdown, etc.)

    +
    +

    Quarto

    +
    +

    Custom crossref styles

    +

    In Quarto, it is possible to create a custom crossref type for things like appendix tables. One challenge, is that LaTeX will not allow users to nest a tblr environment, inside a table environment, inside the new environment that Quarto creates for the crossref. Therefore, when rendering a table to LaTeX/PDF, it is important to drop the \begin{table} environment. This can be done using the theme_tt() function.

    +

    In the example below, we call theme_tt() explicitly for a single table, but the themes vignette shows how to set a global theme using the tinytable_tt_theme option.

    +
    ---
    +title: "Crossref Example"
    +format:
    +  pdf: default
    +  html: default
    +crossref:
    +  custom:
    +    - kind: float
    +      key: apptbl
    +      latex-env: apptbl
    +      reference-prefix: Table A
    +      space-before-numbering: false
    +      latex-list-of-description: Appendix Table
    +apptbl-cap-location: top
    +---
    +
    +See @apptbl-testing
    +
    +::: {#apptbl-testing}
    +
    +```{r}
    +library(tinytable)
    +
    +tt(mtcars[1:5,]) |> theme_tt("tabular", style = "tabularray")
    +```
    +
    +Caption goes here.
    +
    +:::
    +
    +
    +

    Sub-captions

    +

    With version 0.4.0 of tinytable and versions above 1.6 of Quarto—only available as a pre-release build at the time of writing— users can specify sub-captions for tables. This is done by adding a tbl-subcap chunk option to the table chunk. We also need to use a tinytable theme to remove built-in table structure and let Quarto handle the table construction. Here is a simple example document:

    +
    ---
    +format: pdf
    +---
    +
    +See @tbl-example, @tbl-example-1, or @tbl-example-2.
    +
    +```{r}
    +#| label: tbl-example
    +#| tbl-cap: "Example"
    +#| tbl-subcap: 
    +#|   - "Cars"
    +#|   - "Pressure"
    +#| layout-ncol: 2
    +
    +library(tinytable)
    +tt(head(cars)) |> theme_tt("tabular", style = "tabularray")
    +tt(head(pressure)) |> theme_tt("tabular", style = "tabularray")
    +```
    +
    +
    +

    Same table, different styles

    +

    In some cases, the user wants to print a single table multiple times with different styles in a single HTML document. This will sometimes cause issues, because the style_tt() function inserts several javascript functions to modify the same table, thus creating conflicts. A simple solution is to change the unique ID of the table object manually.

    +

    Consider this RevalJS slideshow in which we sequentially highlight different rows of the data frame:

    +
    ---
    +format: revealjs
    +---
    +
    +## Page 1
    +
    +```{r}
    +library(tinytable)
    +
    +tab <- tt(head(iris))
    +tab
    +```
    +
    +## Page 2
    +
    +```{r}
    +tab@id <- "table_01"
    +tab |> style_tt(i = 3, background = "skyblue")
    +```
    +
    +## Page 3
    +
    +```{r}
    +tab@id <- "table_02"
    +tab |> style_tt(i = 5, background = "orange")
    +```
    +
    +
    +
    +

    Bookdown

    +
    +

    Cross-references

    +

    The bookdown package uses a special syntax to handle cross-references, and it does not recognize tinytable objects as tables automatically. To include cross-references to tables, it is thus necessary to use the caption argument of tinytable::tt(), and to insert a bookdown label in that caption. Here is an example:

    +
    Table \@ref(tab:tinytableref)
    +
    +::: {.cell}
    +
    +```{.r .cell-code}
    +library(tinytable)
    +tt(head(iris), caption = "(#tab:tinytableref) Hello world!") |> style_tt(color = "blue")
    +```
    +
    +::: {.cell-output-display}
    +
    +```{=html}
    +<!-- preamble start -->
    +
    +    <script>
    +
    +      function styleCell_frpqc9ghwr94po5zsann(i, j, css_id) {
    +          var table = document.getElementById("tinytable_frpqc9ghwr94po5zsann");
    +          var cell = table.rows[i]?.cells[j];  // Safe navigation to avoid errors
    +          if (cell) {
    +              console.log(`Styling cell at (${i}, ${j}) with class ${css_id}`);
    +              cell.classList.add(css_id);
    +          } else {
    +              console.warn(`Cell at (${i}, ${j}) not found.`);
    +          }
    +      }
    +      function insertSpanRow(i, colspan, content) {
    +        var table = document.getElementById('tinytable_frpqc9ghwr94po5zsann');
    +        var newRow = table.insertRow(i);
    +        var newCell = newRow.insertCell(0);
    +        newCell.setAttribute("colspan", colspan);
    +        // newCell.innerText = content;
    +        // this may be unsafe, but innerText does not interpret <br>
    +        newCell.innerHTML = content;
    +      }
    +      function spanCell_frpqc9ghwr94po5zsann(i, j, rowspan, colspan) {
    +        var table = document.getElementById("tinytable_frpqc9ghwr94po5zsann");
    +        const targetRow = table.rows[i];
    +        const targetCell = targetRow.cells[j];
    +        for (let r = 0; r < rowspan; r++) {
    +          // Only start deleting cells to the right for the first row (r == 0)
    +          if (r === 0) {
    +            // Delete cells to the right of the target cell in the first row
    +            for (let c = colspan - 1; c > 0; c--) {
    +              if (table.rows[i + r].cells[j + c]) {
    +                table.rows[i + r].deleteCell(j + c);
    +              }
    +            }
    +          }
    +          // For rows below the first, delete starting from the target column
    +          if (r > 0) {
    +            for (let c = colspan - 1; c >= 0; c--) {
    +              if (table.rows[i + r] && table.rows[i + r].cells[j]) {
    +                table.rows[i + r].deleteCell(j);
    +              }
    +            }
    +          }
    +        }
    +        // Set rowspan and colspan of the target cell
    +        targetCell.rowSpan = rowspan;
    +        targetCell.colSpan = colspan;
    +      }
    +      // tinytable span after
    +      window.addEventListener('load', function () {
    +          var cellsToStyle = [
    +            // tinytable style arrays after
    +          { positions: [ { i: 1, j: 0 }, { i: 3, j: 0 }, { i: 4, j: 0 }, { i: 5, j: 0 }, { i: 2, j: 0 }, { i: 4, j: 1 }, { i: 1, j: 1 }, { i: 2, j: 1 }, { i: 3, j: 1 }, { i: 1, j: 2 }, { i: 5, j: 1 }, { i: 3, j: 2 }, { i: 4, j: 2 }, { i: 5, j: 2 }, { i: 2, j: 2 }, { i: 4, j: 3 }, { i: 1, j: 3 }, { i: 2, j: 3 }, { i: 3, j: 3 }, { i: 1, j: 4 }, { i: 5, j: 3 }, { i: 3, j: 4 }, { i: 4, j: 4 }, { i: 5, j: 4 }, { i: 2, j: 4 },  ], css_id: 'tinytable_css_xqcl18io8ec76x2kix8x',}, 
    +          { positions: [ { i: 0, j: 0 }, { i: 6, j: 1 }, { i: 6, j: 0 }, { i: 0, j: 1 }, { i: 6, j: 2 }, { i: 0, j: 3 }, { i: 0, j: 2 }, { i: 6, j: 3 }, { i: 0, j: 4 }, { i: 6, j: 4 },  ], css_id: 'tinytable_css_chziz26k3z98stuppmlz',}, 
    +          ];
    +
    +          // Loop over the arrays to style the cells
    +          cellsToStyle.forEach(function (group) {
    +              group.positions.forEach(function (cell) {
    +                  styleCell_frpqc9ghwr94po5zsann(cell.i, cell.j, group.css_id);
    +              });
    +          });
    +      });
    +    </script>
    +
    +    <style>
    +      /* tinytable css entries after */
    +      .table td.tinytable_css_xqcl18io8ec76x2kix8x, .table th.tinytable_css_xqcl18io8ec76x2kix8x { color: blue; }
    +      .table td.tinytable_css_chziz26k3z98stuppmlz, .table th.tinytable_css_chziz26k3z98stuppmlz { color: blue; border-bottom: solid #d3d8dc 0.1em; }
    +    </style>
    +    <div class="container">
    +      <table class="table table-borderless" id="tinytable_frpqc9ghwr94po5zsann" style="width: auto; margin-left: auto; margin-right: auto;" data-quarto-disable-processing='true'>
    +        <thead>
    +        <caption>(#tab:tinytableref) Hello world!</caption>
    +              <tr>
    +                <th scope="col">Sepal.Length</th>
    +                <th scope="col">Sepal.Width</th>
    +                <th scope="col">Petal.Length</th>
    +                <th scope="col">Petal.Width</th>
    +                <th scope="col">Species</th>
    +              </tr>
    +        </thead>
    +        
    +        <tbody>
    +                <tr>
    +                  <td>5.1</td>
    +                  <td>3.5</td>
    +                  <td>1.4</td>
    +                  <td>0.2</td>
    +                  <td>setosa</td>
    +                </tr>
    +                <tr>
    +                  <td>4.9</td>
    +                  <td>3.0</td>
    +                  <td>1.4</td>
    +                  <td>0.2</td>
    +                  <td>setosa</td>
    +                </tr>
    +                <tr>
    +                  <td>4.7</td>
    +                  <td>3.2</td>
    +                  <td>1.3</td>
    +                  <td>0.2</td>
    +                  <td>setosa</td>
    +                </tr>
    +                <tr>
    +                  <td>4.6</td>
    +                  <td>3.1</td>
    +                  <td>1.5</td>
    +                  <td>0.2</td>
    +                  <td>setosa</td>
    +                </tr>
    +                <tr>
    +                  <td>5.0</td>
    +                  <td>3.6</td>
    +                  <td>1.4</td>
    +                  <td>0.2</td>
    +                  <td>setosa</td>
    +                </tr>
    +                <tr>
    +                  <td>5.4</td>
    +                  <td>3.9</td>
    +                  <td>1.7</td>
    +                  <td>0.4</td>
    +                  <td>setosa</td>
    +                </tr>
    +        </tbody>
    +      </table>
    +    </div>
    +<!-- hack to avoid NA insertion in last line -->
    +```
    +
    +:::
    +:::
    + + +
    +
    +
    + +
    + +
    + + + + + \ No newline at end of file diff --git a/vignettes/options.html b/vignettes/options.html index 2a470138..54b0109c 100644 --- a/vignettes/options.html +++ b/vignettes/options.html @@ -161,6 +161,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • diff --git a/vignettes/plot.html b/vignettes/plot.html index 36450f34..208d80b4 100644 --- a/vignettes/plot.html +++ b/vignettes/plot.html @@ -163,6 +163,10 @@
  • Available Options +
  • +
  • + + Notebooks (Quarto, Rmarkdown, Bookdown, etc.)
  • @@ -432,8 +436,8 @@

    Inserting image