From 08e50907ad561406b2f827b61e1c8457ba09a77d Mon Sep 17 00:00:00 2001 From: vincentarelbundock Date: Mon, 22 Jan 2024 01:28:42 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20vincenta?= =?UTF-8?q?relbundock/tinytable@ff41ebb9ad8a2a6fb02c3ca22a7c9657dfdc4b38?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- freeze.rds | Bin 390 -> 389 bytes man/format_tt.html | 18 +- man/plot_tt.html | 79 +- man/tt.html | 20 +- search.json | 56 +- .../id2y4v7ej9rub2ei9fwhma.png | Bin 0 -> 2564 bytes .../iddt06gc0pnnqqvmejh8uk.png | Bin 0 -> 12212 bytes .../iddysue7c0r4ptn1l5a9lb.png | Bin 0 -> 1829 bytes .../idfzetzes6d9zgiosx8t5p.png | Bin 0 -> 2214 bytes .../idgaxya0dqrd9gv1l1si7y.png | Bin 0 -> 653 bytes .../idghqgufpn4yvr0itgg607.png | Bin 0 -> 2444 bytes .../idhkvktlr57kmwyfb9978e.png | Bin 0 -> 1127 bytes .../idk4dcglzs9m1szogvdl7t.png | Bin 0 -> 1728 bytes .../idlic7khdontarbwm979hi.png | Bin 0 -> 650 bytes .../idn0g27j270ity235bo1yb.png | Bin 0 -> 2072 bytes .../idsi1q4grodkqksqly9yho.png | Bin 0 -> 11908 bytes .../idw66vxlc6j9ddy5787hjc.png | Bin 0 -> 1846 bytes .../idwetb2ioxjo0b6wyfr0h0.png | Bin 0 -> 11922 bytes .../idwhuv6v6j1ico8s88fwl3.png | Bin 0 -> 709 bytes .../idziuwr5ugci7hiwhuq8zm.png | Bin 0 -> 2191 bytes vignettes/tutorial.html | 1768 +++++++++-------- vignettes/tutorial.pdf | Bin 1585034 -> 1633880 bytes 22 files changed, 1044 insertions(+), 897 deletions(-) create mode 100644 vignettes/tinytable_assets/id2y4v7ej9rub2ei9fwhma.png create mode 100644 vignettes/tinytable_assets/iddt06gc0pnnqqvmejh8uk.png create mode 100644 vignettes/tinytable_assets/iddysue7c0r4ptn1l5a9lb.png create mode 100644 vignettes/tinytable_assets/idfzetzes6d9zgiosx8t5p.png create mode 100644 vignettes/tinytable_assets/idgaxya0dqrd9gv1l1si7y.png create mode 100644 vignettes/tinytable_assets/idghqgufpn4yvr0itgg607.png create mode 100644 vignettes/tinytable_assets/idhkvktlr57kmwyfb9978e.png create mode 100644 vignettes/tinytable_assets/idk4dcglzs9m1szogvdl7t.png create mode 100644 vignettes/tinytable_assets/idlic7khdontarbwm979hi.png create mode 100644 vignettes/tinytable_assets/idn0g27j270ity235bo1yb.png create mode 100644 vignettes/tinytable_assets/idsi1q4grodkqksqly9yho.png create mode 100644 vignettes/tinytable_assets/idw66vxlc6j9ddy5787hjc.png create mode 100644 vignettes/tinytable_assets/idwetb2ioxjo0b6wyfr0h0.png create mode 100644 vignettes/tinytable_assets/idwhuv6v6j1ico8s88fwl3.png create mode 100644 vignettes/tinytable_assets/idziuwr5ugci7hiwhuq8zm.png diff --git a/freeze.rds b/freeze.rds index 2e9157b07af77b87ab3349b66f434b53f564b28c..efcf001caad372185c6fe67b916d5184def12917 100644 GIT binary patch literal 389 zcmV;00eb!)iwFP!0000017(prZxk^QfXzLMq<~b2l0T5dYme=5iA3mVB9Q2!@jN2L z-R*I=Amz^^_Ac3wkiydVn{Q_P_;%`?o4dt)=H|;Wbjz<_KAod;v$Jt?;uhm_?tPPj zAW@Zb1yk%GV)Ym@`@leP@`%*T&^n0%*}S*h$QKeySwYL>`RqA@FPS3OLX9he8G9rd zoBBF=5<|ljl6b_L6NksSRl6KhD?TReI0deXzLjh_WDw~lFEb(q<=RqX z1t?hxU@1g}QRCzJ#>-`CDO+cf3?&z3X{urpqQpFTS^)zGPqi|P1r?wJfK+1$(nKfE zB3VhI6k|%zLWh9d6qy2HY2$k@W~2A&!C!7@t@|-}`U$7kS06rpzPk9imIrdSrp=}G zyEP3r!*Fpu@izy4yX${#pW)XByj}IfOS-4u`i#Ck(&28UH?8l7{jj6$e*^BbPmA6i j@bGCAL z>6_Xzd5*zx_0?t-7fNtF^jQMB=xud6c|~0cv1S{hI*y);qOCc#Examples - tinytable_dm3nzxhtw1qpjjo0de2j + tinytable_pcjh9ehr4sqf2tedn7ru @@ -439,7 +439,7 @@

Examples

- +
@@ -450,16 +450,16 @@

Examples

- - + + - + - +
10 000 9 99910 00110 001
10 00010 001 9 999
10 00010 000 9 999
@@ -467,12 +467,12 @@

Examples

@@ -746,7 +747,7 @@

Alignment

- +
@@ -778,12 +779,12 @@

Alignment

@@ -817,12 +818,12 @@

Alignment

- tinytable_dw7zh6343xbyk9hvdzdf + tinytable_a9yy0l67aeqvbvz0wjxw @@ -840,7 +841,7 @@

Alignment

-
+
@@ -872,12 +873,12 @@

Alignment

@@ -924,7 +925,7 @@

Form - tinytable_qfgjsihvxmfg4bz9mujk + tinytable_jxho9gqj65d3j6wd0c68 @@ -944,7 +945,7 @@

Form
-

+
@@ -959,19 +960,19 @@

Form

- + - + - + @@ -980,12 +981,12 @@

Form @@ -1886,7 +1887,7 @@

Math

-
143002 1.431972-04-141972-04-30 True
201399 201.401972-08-121970-10-08 True
100188 0.131970-03-011970-11-08 False
+
@@ -1907,12 +1908,12 @@

Math

@@ -1949,10 +1950,10 @@

Markdown

- tinytable_odzlqaz1diastaaini51 + tinytable_18dmvohw3f80qobl2l6x @@ -1970,7 +1971,7 @@

Markdown

-
+
@@ -1991,12 +1992,12 @@

Markdown

@@ -2049,7 +2050,7 @@

Markdown

- tinytable_05o6gix9bmu1poery4ll + tinytable_80w0zas1hvxaq0nr1hy8 @@ -2069,7 +2070,7 @@

Markdown

-
+
@@ -2121,12 +2122,12 @@

Markdown

@@ -2207,7 +2208,7 @@

Cells, rows, columns -

+
@@ -2254,12 +2255,12 @@

Cells, rows, columns @@ -2290,10 +2291,10 @@

Cells, rows, columns - tinytable_w8zn5deo5a3l07s3kpy5 + tinytable_kbz616o068o582dbhigk @@ -2311,7 +2312,7 @@

Cells, rows, columns -

+
@@ -2358,12 +2359,12 @@

Cells, rows, columns @@ -2394,10 +2395,10 @@

Cells, rows, columns - tinytable_6zcdbv2czdj3ajgiq101 + tinytable_shggseip7uwosn25yle7 @@ -2415,7 +2416,7 @@

Cells, rows, columns -

+
@@ -2462,12 +2463,12 @@

Cells, rows, columns @@ -2512,10 +2513,10 @@

Cells, rows, columns - tinytable_igay6b6iiyah1yrxnx0k + tinytable_gtnd7islsfan1v3p5iy3 @@ -2533,7 +2534,7 @@

Cells, rows, columns -

+
@@ -2580,12 +2581,12 @@

Cells, rows, columns @@ -2620,10 +2621,10 @@

Cells, rows, columns - tinytable_mwfhczzsp7m2pk3ngf3e + tinytable_7ah49k98t5kluws2tp8r @@ -2641,7 +2642,7 @@

Cells, rows, columns -

+
@@ -2688,12 +2689,12 @@

Cells, rows, columns @@ -2728,10 +2729,10 @@

Cells, rows, columns - tinytable_8yqqjo9mxr5yktvimk8g + tinytable_fptgbw9g8f29a56th3zr @@ -2749,7 +2750,7 @@

Cells, rows, columns -

+
@@ -2796,12 +2797,12 @@

Cells, rows, columns @@ -2838,11 +2839,11 @@

Cells, rows, columns - tinytable_nlltfnjjnrvckgsmu1co + tinytable_upah6t9nzn69ahv7i99v @@ -2860,7 +2861,7 @@

Cells, rows, columns -

+
@@ -2907,12 +2908,12 @@

Cells, rows, columns @@ -2957,10 +2958,10 @@

Colors

- tinytable_18jgh7vt49y0wtrkhdhu + tinytable_warmg4qz4lembrswc7c5 @@ -2978,7 +2979,7 @@

Colors

-
+
@@ -3025,12 +3026,12 @@

Colors

@@ -3063,10 +3064,10 @@

Fonts

- tinytable_57gl34ayx2eoqol0n681 + tinytable_rlyyq18d8s2pff5kicrw @@ -3084,7 +3085,7 @@

Fonts

-
+
@@ -3131,12 +3132,12 @@

Fonts

@@ -3176,7 +3177,7 @@

Headers

- tinytable_bpsqou3061paoerj68vs + tinytable_many0jwco1igjes2s7b1 @@ -3196,7 +3197,7 @@

Headers

-
+
@@ -3236,12 +3237,12 @@

Headers

@@ -3288,7 +3289,7 @@

Headers

-
+
@@ -3335,12 +3336,12 @@

Headers

@@ -3370,10 +3371,10 @@

Headers

- tinytable_08zzyl6g0c95io7jwiym + tinytable_gfkrmhrw7vynjydgk8x5 @@ -3391,7 +3392,7 @@

Headers

-
+
@@ -3438,12 +3439,12 @@

Headers

@@ -3487,10 +3488,10 @@

Conditional styling - tinytable_d0u4fkfy2go65c7z9nym + tinytable_hhp6uilv2dw5f8ej4ft2 @@ -3508,7 +3509,7 @@

Conditional styling -

+
@@ -3575,12 +3576,12 @@

Conditional styling @@ -3620,13 +3621,13 @@

Vectorized sty - tinytable_loojwotvdf2numf6u7y3 + tinytable_kh63r75vvkt0xr6rc9hp @@ -3644,7 +3645,7 @@

Vectorized sty
-

+
@@ -3691,12 +3692,12 @@

Vectorized sty @@ -3745,11 +3746,11 @@

Vectorized sty - tinytable_6nyaihkqubv7s8ihi3ns + tinytable_hqxjtl40v500v612k9dd @@ -3767,7 +3768,7 @@

Vectorized sty
-

+
@@ -3814,12 +3815,12 @@

Vectorized sty @@ -3870,30 +3871,30 @@

Vectorized sty - tinytable_7h41orhl8yh85a2k2z8u + tinytable_j43euts2iw0nmgeqval7 @@ -3911,7 +3912,7 @@

Vectorized sty
-

+
@@ -3951,12 +3952,12 @@

Vectorized sty @@ -4019,18 +4020,22 @@

Tiny plots and images

Inserting images in tables

To insert images in a table, we use the plot_tt() function. The path_img values must be relative to the main document saved by save_tt() or to the Quarto (or Rmarkdown) document in which the code is executed.

-
dat <- data.frame(
-  Species = c("Spider", "Squirrel"),
-  Image = ""
-)
-
-img <- c(
-  "../man/figures/spider.png",
-  "../man/figures/squirrel.png"
-)
-
-tt(dat) |>
-  plot_tt(j = 2, path_img = img, height = 3)
+
pkgload::load_all()
+
+
ℹ Loading tinytable
+
+
dat <- data.frame(
+  Species = c("Spider", "Squirrel"),
+  Image = ""
+)
+
+img <- c(
+  "../man/figures/spider.png",
+  "../man/figures/squirrel.png"
+)
+
+tt(dat) |>
+  plot_tt(j = 2, images = img, height = 3)
@@ -4038,7 +4043,7 @@

Inserting image - tinytable_kc8tqrv0vu10ax2nnc64 + tinytable_p6jx5nfpvtayphsvk3x1 @@ -4058,7 +4063,7 @@

Inserting image
-

+
@@ -4082,12 +4087,12 @@

Inserting image @@ -4138,7 +4143,7 @@

Inserting image
-

+
@@ -4156,12 +4161,12 @@

Inserting image @@ -4181,20 +4186,135 @@

Inserting image

Inline plots

+
+

Built-in plots

+

There are several types of inline plots available by default. For example,

+
+
plot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)
+
+dat <- data.frame(
+  Variables = c("mpg", "hp", "qsec"), 
+  Histogram = "",
+  Density = "",
+  Bar = ""
+)
+
+tt(dat) |>
+  plot_tt(j = 2, fun = "histogram", data = plot_data) |>
+  plot_tt(j = 3, fun = "density", data = plot_data, color = "darkgreen") |>
+  plot_tt(j = 4, fun = "bar", data = list(2, 3, 6), color = "orange") |>
+  style_tt(j = 2:4, align = "c")
+
+ + + + + + + tinytable_ljvwbjz5swmczqqv0fq6 + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VariablesHistogramDensityBar
mpg
hp
qsec
+
+ + + + + + + +
+ +

Custom plots: Base R

-
f <- function(d) {
-  function() hist(d, axes = FALSE, ann = FALSE)
-}
-
-plot_fun <- rep(list(f), 3)
-plot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)
-
-dat <- data.frame(Variables = c("mpg", "hp", "qsec"), Histogram = "")
-
-tt(dat) |>
-  plot_tt(j = 2, plot_fun = plot_fun, plot_data = plot_data)
+
f <- function(d, ...) {
+  function() hist(d, axes = FALSE, ann = FALSE, col = "lightblue")
+}
+
+plot_fun <- rep(list(f), 3)
+plot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)
+
+dat <- data.frame(Variables = c("mpg", "hp", "qsec"), Histogram = "")
+
+tt(dat) |>
+  plot_tt(j = 2, fun = plot_fun, data = plot_data)
@@ -4202,7 +4322,7 @@

Custom plots: Base - tinytable_nu1a5lqnhqgwr4lwcu11 + tinytable_x21a2pvxia9ruid1zfka @@ -4222,7 +4342,7 @@

Custom plots: Base - +
@@ -4234,15 +4354,15 @@

Custom plots: Base

- + - + - +
mpg
hp
qsec
@@ -4250,12 +4370,12 @@

Custom plots: Base @@ -4411,7 +4531,7 @@

Rows

- +
@@ -4523,12 +4643,12 @@

Rows

@@ -4568,18 +4688,18 @@

Rows

We can style group rows in the same way as regular rows:

-
tt(dat) |> 
-  group_tt(
-    i = list(
-      "I like (fake) hamburgers" = 3,
-      "She prefers halloumi" = 4,
-      "They love tofu" = 7)) |>
-  style_tt(
-    i = c(3, 5, 9),
-    align = "c",
-    color = "white",
-    background = "gray",
-    bold = TRUE)
+
tt(dat) |> 
+  group_tt(
+    i = list(
+      "I like (fake) hamburgers" = 3,
+      "She prefers halloumi" = 4,
+      "They love tofu" = 7)) |>
+  style_tt(
+    i = c(3, 5, 9),
+    align = "c",
+    color = "white",
+    background = "gray",
+    bold = TRUE)
@@ -4587,12 +4707,12 @@

Rows

- tinytable_rj2t9wjninlyifotw35n + tinytable_ysv0w4gij08x9x7ekmg8 @@ -4610,7 +4730,7 @@

Rows

-
+
@@ -4722,12 +4842,12 @@

Rows

@@ -4794,12 +4914,12 @@

Rows

Columns

The syntax for column groups is very similar, but we use the j argument instead. The named list specifies the labels to appear in column-spanning labels, and the values must be a vector of consecutive and non-overlapping integers that indicate which columns are associated to which labels:

-
tt(dat) |> 
-  group_tt(
-    j = list(
-      "Hamburgers" = 1:3,
-      "Halloumi" = 4:5,
-      "Tofu" = 7))
+
tt(dat) |> 
+  group_tt(
+    j = list(
+      "Hamburgers" = 1:3,
+      "Halloumi" = 4:5,
+      "Tofu" = 7))
@@ -4807,7 +4927,7 @@

Columns

- tinytable_me3om84yz8w99xnchnuu + tinytable_r20l6rv219bgped1y76o @@ -4827,7 +4947,7 @@

Columns

-
+
@@ -4944,12 +5064,12 @@

Columns

@@ -5012,7 +5132,7 @@

Columns

-
Hamburgers Halloumi
+
@@ -5129,12 +5249,12 @@

Columns

@@ -5213,7 +5333,7 @@

Themes

The Bootstrap framework provides a number of built-in themes to style tables, using “classes.” To use them, we call style_tt() with the bootstrap_class argument. A list of available Bootstrap classes can be found here: https://getbootstrap.com/docs/5.3/content/tables/

For example, to produce a “dark” table, we use the table-dark class:

-
tt(x) |> style_tt(bootstrap_class = "table table-dark")
+
tt(x) |> style_tt(bootstrap_class = "table table-dark")
@@ -5221,10 +5341,10 @@

Themes

- tinytable_wvw7ninepygewmpjrbws + tinytable_rl378z00z8y9k81r8hx6 @@ -5242,7 +5362,7 @@

Themes

-
Hamburgers Halloumi
+
@@ -5289,12 +5409,12 @@

Themes

@@ -5331,8 +5451,8 @@

Themes

We can also combine several Bootstrap classes. Here, we get a “striped” table with the “warning” color and hover feature:

-
tt(x) |> style_tt(
-  bootstrap_class = "table table-striped table-warning table-hover")
+
tt(x) |> style_tt(
+  bootstrap_class = "table table-striped table-warning table-hover")
@@ -5340,10 +5460,10 @@

Themes

- tinytable_k76nt441gio6no12wg0c + tinytable_kopwvry8qvif9ts7j3fu @@ -5361,7 +5481,7 @@

Themes

-
+
@@ -5408,12 +5528,12 @@

Themes

@@ -5453,8 +5573,8 @@

Themes

CSS declarations

The style_tt() function allows us to declare CSS properties and values for individual cells, columns, or rows of a table. For example, if we want to make the first column bold, we could do:

-
tt(x) |>
-  style_tt(j = 1, bootstrap_css = "font-weight: bold; color: red;")
+
tt(x) |>
+  style_tt(j = 1, bootstrap_css = "font-weight: bold; color: red;")
@@ -5462,10 +5582,10 @@

CSS declarations

- tinytable_cq1fxg0pw4gsoauaytnk + tinytable_q9wkp108uqtuc59uek3j @@ -5483,7 +5603,7 @@

CSS declarations

-
+
@@ -5530,12 +5650,12 @@

CSS declarations

@@ -5560,43 +5680,43 @@

CSS declarations

CSS rules

For more extensive customization, we can use complete CSS rules. In this example, we define several rules that apply to a new class called mytable. Then, we use the theme argument of the tt() function to ensure that our tiny table is of class mytable. Finally, we call style_bootstrap() to apply the rules with the bootstrap_css_rule argument.

-
css_rule <- "
-.mytable {
-  background: linear-gradient(45deg, #EA8D8D, #A890FE);
-  width: 600px;
-  border-collapse: collapse;
-  overflow: hidden;
-  box-shadow: 0 0 20px rgba(0,0,0,0.1);
-}
-
-.mytable th,
-.mytable td {
-  padding: 5px;
-  background-color: rgba(255,255,255,0.2);
-  color: #fff;
-}
-
-.mytable tbody tr:hover {
-  background-color: rgba(255,255,255,0.3);
-}
-
-.mytable tbody td:hover:before {
-  content: '';
-  position: absolute;
-  left: 0;
-  right: 0;
-  top: -9999px;
-  bottom: -9999px;
-  background-color: rgba(255,255,255,0.2);
-  z-index: -1;
-}
-"
-
-tt(x, theme = "table mytable", width = 2/3) |> 
-  style_tt(
-    j = 1:5,
-    align = "ccccc",
-    bootstrap_css_rule = css_rule)
+
css_rule <- "
+.mytable {
+  background: linear-gradient(45deg, #EA8D8D, #A890FE);
+  width: 600px;
+  border-collapse: collapse;
+  overflow: hidden;
+  box-shadow: 0 0 20px rgba(0,0,0,0.1);
+}
+
+.mytable th,
+.mytable td {
+  padding: 5px;
+  background-color: rgba(255,255,255,0.2);
+  color: #fff;
+}
+
+.mytable tbody tr:hover {
+  background-color: rgba(255,255,255,0.3);
+}
+
+.mytable tbody td:hover:before {
+  content: '';
+  position: absolute;
+  left: 0;
+  right: 0;
+  top: -9999px;
+  bottom: -9999px;
+  background-color: rgba(255,255,255,0.2);
+  z-index: -1;
+}
+"
+
+tt(x, theme = "table mytable", width = 2/3) |> 
+  style_tt(
+    j = 1:5,
+    align = "ccccc",
+    bootstrap_css_rule = css_rule)
@@ -5604,10 +5724,10 @@

CSS rules

- tinytable_4584gpufindg1kpd8ggx + tinytable_bb282u3jb9swjn29w9mm