diff --git a/CITATION.html b/CITATION.html index 7b17cb8d..c49ec0fa 100644 --- a/CITATION.html +++ b/CITATION.html @@ -348,7 +348,7 @@

Citation

Arel-Bundock V (????). _tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' - Formats_. R package version 0.2.1.14, + Formats_. R package version 0.2.1.15, <https://vincentarelbundock.github.io/tinytable/>. A BibTeX entry for LaTeX users is @@ -356,7 +356,7 @@

Citation

@Manual{, title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats}, author = {Vincent Arel-Bundock}, - note = {R package version 0.2.1.14}, + note = {R package version 0.2.1.15}, url = {https://vincentarelbundock.github.io/tinytable/}, } diff --git a/NEWS.html b/NEWS.html index 83842740..4574c9e5 100644 --- a/NEWS.html +++ b/NEWS.html @@ -392,6 +392,7 @@

Development

Misc:

diff --git a/man/format_tt.html b/man/format_tt.html index e7320ece..980d0a98 100644 --- a/man/format_tt.html +++ b/man/format_tt.html @@ -651,9 +651,9 @@

Examples

- tinytable_u3ujbus1dmifd7qhrcbx + tinytable_jnyb4qqdm7s0k3jbt40u @@ -671,7 +671,7 @@

Examples

- +
@@ -682,28 +682,28 @@

Examples

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

Examples

- tinytable_hosoeyap1fgvfe2hgg1t + tinytable_5o15ym2a6rpp3yprifsl @@ -775,7 +775,7 @@

Examples

- +
@@ -795,12 +795,12 @@

Examples

@@ -857,9 +857,9 @@

Examples

- tinytable_9hkha0yd501hno9j5tr8 + tinytable_pls6zso81vu535rkkv70 @@ -877,7 +877,7 @@

Examples

-
+
@@ -913,12 +913,12 @@

Examples

@@ -971,9 +971,9 @@

Examples

- tinytable_e1mn2m98ez4a1dfwrbc5 + tinytable_cjonjmu3vg1rnptk90nx @@ -991,7 +991,7 @@

Examples

-
+
@@ -1011,12 +1011,12 @@

Examples

@@ -1067,9 +1067,9 @@

Examples

- tinytable_j4e0sfn4mxnuf061ju6l + tinytable_pvmhboupgbw9t2fd1wj1 @@ -1087,7 +1087,7 @@

Examples

-
+
@@ -1107,12 +1107,12 @@

Examples

@@ -1163,9 +1163,9 @@

Examples

- tinytable_ryodjjtpo5j838ps7rxa + tinytable_4gehw0nf9zv3n5fya27a @@ -1183,7 +1183,7 @@

Examples

-
+
@@ -1210,12 +1210,12 @@

Examples

@@ -1270,9 +1270,9 @@

Examples

- tinytable_5qrapsjal9hp9p2iecoz + tinytable_ecgott1pbt8jwznsjoh3 @@ -1290,7 +1290,7 @@

Examples

-
+
@@ -1317,12 +1317,12 @@

Examples

diff --git a/man/group_tt.html b/man/group_tt.html index 066f0208..3f4895c1 100644 --- a/man/group_tt.html +++ b/man/group_tt.html @@ -469,13 +469,13 @@

Examples

- tinytable_etags4019hq831nm7acf + tinytable_cu55rhsbmmj0sg5hcvee @@ -493,7 +493,7 @@

Examples

-
+
@@ -586,12 +586,12 @@

Examples

@@ -674,11 +674,11 @@

Examples

- tinytable_mg8m6lvftxy8mjl1ujra + tinytable_90t3b56f2hadcz6o1q8p @@ -696,7 +696,7 @@

Examples

-
+
@@ -807,12 +807,12 @@

Examples

@@ -894,11 +894,11 @@

Examples

- tinytable_uoviwg5ctd4qcwdwobb9 + tinytable_miwue3m6isys93t209y4 @@ -916,7 +916,7 @@

Examples

-
+
@@ -1034,12 +1034,12 @@

Examples

@@ -1110,13 +1110,13 @@

Examples

- tinytable_bqh6ydrds2r4c7c3m2s2 + tinytable_b4zfo1mrn4xeynm9wzf9 @@ -1134,7 +1134,7 @@

Examples

-
Hamburgers
+
@@ -1202,12 +1202,12 @@

Examples

diff --git a/man/rbind2-tinytable-ANY-method.html b/man/rbind2-tinytable-ANY-method.html index 9e5cc3c4..552e64af 100644 --- a/man/rbind2-tinytable-ANY-method.html +++ b/man/rbind2-tinytable-ANY-method.html @@ -485,9 +485,9 @@

Examples

- tinytable_svmy27x10n0adeeyfpwi + tinytable_d3gjtwwmzdrr9f5bz7vc @@ -505,7 +505,7 @@

Examples

-
Foo
+
@@ -565,12 +565,12 @@

Examples

@@ -624,9 +624,9 @@

Examples

- tinytable_abl7vf6h5lqvpzvh8ley + tinytable_mi5xid9y3kk5xwtxh3co @@ -644,7 +644,7 @@

Examples

-
Combine two tiny tables.
+
@@ -704,12 +704,12 @@

Examples

@@ -764,9 +764,9 @@

Examples

- tinytable_bhmd0dnpaz273884kc1y + tinytable_4mozv39s65l14x5q303h @@ -784,7 +784,7 @@

Examples

-
Combine two tiny tables.
+
@@ -837,12 +837,12 @@

Examples

@@ -897,9 +897,9 @@

Examples

- tinytable_ilsq6t1yl65fuzwf9zft + tinytable_1nqk2kwj7e5for9rssz7 @@ -917,7 +917,7 @@

Examples

-
Combine two tiny tables.
+
@@ -963,12 +963,12 @@

Examples

diff --git a/man/theme_tt.html b/man/theme_tt.html index 5bf1c3b4..4cce598b 100644 --- a/man/theme_tt.html +++ b/man/theme_tt.html @@ -505,7 +505,7 @@

Examples

- tinytable_9mkw5vuibthqgxxgz13b + tinytable_2l25bosu8ms8wz1vsw37 @@ -524,7 +524,7 @@

Examples

-
Combine two tiny tables.
+
@@ -565,12 +565,12 @@

Examples

@@ -639,7 +639,7 @@

Examples

-
+
@@ -680,12 +680,12 @@

Examples

diff --git a/man/tt.html b/man/tt.html index 19e94088..69d7bcfd 100644 --- a/man/tt.html +++ b/man/tt.html @@ -567,9 +567,9 @@

Examples

- tinytable_87jhu0hvppld9788btf5 + tinytable_hc59npqb4vegpqmpve85 @@ -587,7 +587,7 @@

Examples

-
+
@@ -633,12 +633,12 @@

Examples

@@ -695,7 +695,7 @@

Examples

- tinytable_bo5mixdsxheh8ytmoxb4 + tinytable_eiwoduhsfqvzpugkpf2g @@ -714,7 +714,7 @@

Examples

-
+
@@ -760,12 +760,12 @@

Examples

@@ -834,7 +834,7 @@

Examples

-
Data about cars.
+
@@ -880,12 +880,12 @@

Examples

@@ -963,9 +963,9 @@

Examples

- tinytable_ngwdoogofelcuszf0tic + tinytable_y6eoobhlg2py7lo9cxn0 @@ -983,7 +983,7 @@

Examples

-
+
@@ -1003,12 +1003,12 @@

Examples

diff --git a/search.json b/search.json index a19979d1..c1afce34 100644 --- a/search.json +++ b/search.json @@ -72,7 +72,7 @@ "href": "man/rbind2-tinytable-ANY-method.html", "title": "tinytable", "section": "", - "text": "Combine tinytable objects by rows (vertically)\n\n\n\n## S4 method for signature 'tinytable,ANY'\nrbind2(x, y, use_names = TRUE, headers = TRUE, ...)\n\n\n\n\n\n\n\nx\n\n\ntinytable object\n\n\n\n\ny\n\n\ntinytable object\n\n\n\n\nuse_names\n\n\n‘TRUE’ binds by matching column name, ‘FALSE’ by position\n\n\n\n\nheaders\n\n\nLogical. TRUE inserts the colnames of y as an extra row between the two tables.\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nformat_tt() calls applied to x or y are evaluated before binding, to allow distinct formatting for each panel.\nCalls to other tinytable functions such as style_tt() or group_tt() are ignored when applied to x or y. These functions should be applied to the final table instead.\nInformation in these S4 slots is carried over from x to the combined table:\n\n\nx@output\n\n\nx@caption\n\n\nx@width\n\n\nInformation in these S4 slots is concatenated and carried over to the combined table:\n\n\nc(x@notes, y@notes)\n\n\nThis function relies on the rbindlist() function from the data.table package.\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx = tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\ny = tt(mtcars[4:5, 8:10]) \n\n# rbind() does not support additional aarguments\n# rbind2() supports additional arguments\n\n# basic combination\nrbind(x, y)\n\n \n\n \n \n \n tinytable_svmy27x10n0adeeyfpwi\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 22.8\n 4 \n NA\n NA\n NA \n \n \n NA \n NA\n vs\n am\n gear\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(x, y) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_abl7vf6h5lqvpzvh8ley\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n# omit y header\nrbind2(x, y, headers = FALSE)\n\n \n\n \n \n \n tinytable_bhmd0dnpaz273884kc1y\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 22.8\n 4 \n NA\n NA\n NA\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\n# bind by position rather than column names\nrbind2(x, y, use_names = FALSE)\n\n \n\n \n \n \n tinytable_ilsq6t1yl65fuzwf9zft\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21.0\n 6 \n NA \n \n \n 21.0\n 6 \n NA \n \n \n 22.8\n 4 \n NA \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", + "text": "Combine tinytable objects by rows (vertically)\n\n\n\n## S4 method for signature 'tinytable,ANY'\nrbind2(x, y, use_names = TRUE, headers = TRUE, ...)\n\n\n\n\n\n\n\nx\n\n\ntinytable object\n\n\n\n\ny\n\n\ntinytable object\n\n\n\n\nuse_names\n\n\n‘TRUE’ binds by matching column name, ‘FALSE’ by position\n\n\n\n\nheaders\n\n\nLogical. TRUE inserts the colnames of y as an extra row between the two tables.\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nformat_tt() calls applied to x or y are evaluated before binding, to allow distinct formatting for each panel.\nCalls to other tinytable functions such as style_tt() or group_tt() are ignored when applied to x or y. These functions should be applied to the final table instead.\nInformation in these S4 slots is carried over from x to the combined table:\n\n\nx@output\n\n\nx@caption\n\n\nx@width\n\n\nInformation in these S4 slots is concatenated and carried over to the combined table:\n\n\nc(x@notes, y@notes)\n\n\nThis function relies on the rbindlist() function from the data.table package.\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx = tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\ny = tt(mtcars[4:5, 8:10]) \n\n# rbind() does not support additional aarguments\n# rbind2() supports additional arguments\n\n# basic combination\nrbind(x, y)\n\n \n\n \n \n \n tinytable_d3gjtwwmzdrr9f5bz7vc\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 22.8\n 4 \n NA\n NA\n NA \n \n \n NA \n NA\n vs\n am\n gear\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(x, y) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_mi5xid9y3kk5xwtxh3co\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n# omit y header\nrbind2(x, y, headers = FALSE)\n\n \n\n \n \n \n tinytable_4mozv39s65l14x5q303h\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 22.8\n 4 \n NA\n NA\n NA\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\n# bind by position rather than column names\nrbind2(x, y, use_names = FALSE)\n\n \n\n \n \n \n tinytable_1nqk2kwj7e5for9rssz7\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21.0\n 6 \n NA \n \n \n 21.0\n 6 \n NA \n \n \n 22.8\n 4 \n NA \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -84,7 +84,7 @@ "href": "man/rbind2-tinytable-ANY-method.html#combine-tinytable-objects-by-rows-vertically", "title": "tinytable", "section": "", - "text": "Combine tinytable objects by rows (vertically)\n\n\n\n## S4 method for signature 'tinytable,ANY'\nrbind2(x, y, use_names = TRUE, headers = TRUE, ...)\n\n\n\n\n\n\n\nx\n\n\ntinytable object\n\n\n\n\ny\n\n\ntinytable object\n\n\n\n\nuse_names\n\n\n‘TRUE’ binds by matching column name, ‘FALSE’ by position\n\n\n\n\nheaders\n\n\nLogical. TRUE inserts the colnames of y as an extra row between the two tables.\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nformat_tt() calls applied to x or y are evaluated before binding, to allow distinct formatting for each panel.\nCalls to other tinytable functions such as style_tt() or group_tt() are ignored when applied to x or y. These functions should be applied to the final table instead.\nInformation in these S4 slots is carried over from x to the combined table:\n\n\nx@output\n\n\nx@caption\n\n\nx@width\n\n\nInformation in these S4 slots is concatenated and carried over to the combined table:\n\n\nc(x@notes, y@notes)\n\n\nThis function relies on the rbindlist() function from the data.table package.\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx = tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\ny = tt(mtcars[4:5, 8:10]) \n\n# rbind() does not support additional aarguments\n# rbind2() supports additional arguments\n\n# basic combination\nrbind(x, y)\n\n \n\n \n \n \n tinytable_svmy27x10n0adeeyfpwi\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 22.8\n 4 \n NA\n NA\n NA \n \n \n NA \n NA\n vs\n am\n gear\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(x, y) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_abl7vf6h5lqvpzvh8ley\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n# omit y header\nrbind2(x, y, headers = FALSE)\n\n \n\n \n \n \n tinytable_bhmd0dnpaz273884kc1y\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 22.8\n 4 \n NA\n NA\n NA\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\n# bind by position rather than column names\nrbind2(x, y, use_names = FALSE)\n\n \n\n \n \n \n tinytable_ilsq6t1yl65fuzwf9zft\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21.0\n 6 \n NA \n \n \n 21.0\n 6 \n NA \n \n \n 22.8\n 4 \n NA \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", + "text": "Combine tinytable objects by rows (vertically)\n\n\n\n## S4 method for signature 'tinytable,ANY'\nrbind2(x, y, use_names = TRUE, headers = TRUE, ...)\n\n\n\n\n\n\n\nx\n\n\ntinytable object\n\n\n\n\ny\n\n\ntinytable object\n\n\n\n\nuse_names\n\n\n‘TRUE’ binds by matching column name, ‘FALSE’ by position\n\n\n\n\nheaders\n\n\nLogical. TRUE inserts the colnames of y as an extra row between the two tables.\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nformat_tt() calls applied to x or y are evaluated before binding, to allow distinct formatting for each panel.\nCalls to other tinytable functions such as style_tt() or group_tt() are ignored when applied to x or y. These functions should be applied to the final table instead.\nInformation in these S4 slots is carried over from x to the combined table:\n\n\nx@output\n\n\nx@caption\n\n\nx@width\n\n\nInformation in these S4 slots is concatenated and carried over to the combined table:\n\n\nc(x@notes, y@notes)\n\n\nThis function relies on the rbindlist() function from the data.table package.\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx = tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\ny = tt(mtcars[4:5, 8:10]) \n\n# rbind() does not support additional aarguments\n# rbind2() supports additional arguments\n\n# basic combination\nrbind(x, y)\n\n \n\n \n \n \n tinytable_d3gjtwwmzdrr9f5bz7vc\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 21.0\n 6 \n NA\n NA\n NA \n \n \n 22.8\n 4 \n NA\n NA\n NA \n \n \n NA \n NA\n vs\n am\n gear\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(x, y) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_mi5xid9y3kk5xwtxh3co\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 21.0\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n# omit y header\nrbind2(x, y, headers = FALSE)\n\n \n\n \n \n \n tinytable_4mozv39s65l14x5q303h\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 21.0\n 6 \n NA\n NA\n NA\n \n \n 22.8\n 4 \n NA\n NA\n NA\n \n \n NA \n NA\n 1 \n 0 \n 3 \n \n \n NA \n NA\n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\n# bind by position rather than column names\nrbind2(x, y, use_names = FALSE)\n\n \n\n \n \n \n tinytable_1nqk2kwj7e5for9rssz7\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21.0\n 6 \n NA \n \n \n 21.0\n 6 \n NA \n \n \n 22.8\n 4 \n NA \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -96,7 +96,7 @@ "href": "man/format_tt.html", "title": "tinytable", "section": "", - "text": "This function formats the columns of a data frame based on the column type (logical, date, numeric). It allows various formatting options like significant digits, decimal points, and scientific notation. It also includes custom formatting for date and boolean values. If this function is applied several times to the same cell, the last transformation is retained and the previous calls are ignored, except for the escape argument which can be applied to previously transformed data.\n\n\n\nformat_tt(\n x,\n i = NULL,\n j = NULL,\n digits = getOption(\"tinytable_format_digits\", default = NULL),\n num_fmt = getOption(\"tinytable_format_num_fmt\", default = \"significant\"),\n num_zero = getOption(\"tinytable_format_num_zero\", default = FALSE),\n num_suffix = getOption(\"tinytable_format_num_suffix\", default = FALSE),\n num_mark_big = getOption(\"tinytable_format_num_mark_big\", default = \"\"),\n num_mark_dec = getOption(\"tinytable_format_num_mark_dec\", default = getOption(\"OutDec\",\n default = \".\")),\n date = getOption(\"tinytable_format_date\", default = \"%Y-%m-%d\"),\n bool = getOption(\"tinytable_format_bool\", default = function(column)\n tools::toTitleCase(tolower(column))),\n other = getOption(\"tinytable_format_other\", default = as.character),\n replace = getOption(\"tinytable_format_replace\", default = TRUE),\n escape = getOption(\"tinytable_format_escape\", default = FALSE),\n markdown = getOption(\"tinytable_format_markdown\", default = FALSE),\n quarto = getOption(\"tinytable_format_quarto\", default = FALSE),\n fn = getOption(\"tinytable_format_fn\", default = NULL),\n sprintf = getOption(\"tinytable_format_sprintf\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\ni\n\n\nRow indices where the formatting should be applied.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be:\n\n\nInteger vectors indicating column positions.\n\n\nCharacter vector indicating column names.\n\n\nA single string specifying a Perl-style regular expression used to match column names.\n\n\n\n\n\n\ndigits\n\n\nNumber of significant digits or decimal places.\n\n\n\n\nnum_fmt\n\n\nThe format for numeric values; one of ‘significant’, ‘significant_cell’, ‘decimal’, or ‘scientific’.\n\n\n\n\nnum_zero\n\n\nLogical; if TRUE, trailing zeros are kept in \"decimal\" format (but not in \"significant\" format).\n\n\n\n\nnum_suffix\n\n\nLogical; if TRUE display short numbers with digits significant digits and K (thousands), M (millions), B (billions), or T (trillions) suffixes.\n\n\n\n\nnum_mark_big\n\n\nCharacter to use as a thousands separator.\n\n\n\n\nnum_mark_dec\n\n\nDecimal mark character. Default is the global option ‘OutDec’.\n\n\n\n\ndate\n\n\nA string passed to the format() function, such as \"%Y-%m-%d\". See the \"Details\" section in ?strptime\n\n\n\n\nbool\n\n\nA function to format logical columns. Defaults to title case.\n\n\n\n\nother\n\n\nA function to format columns of other types. Defaults to as.character().\n\n\n\n\nreplace\n\n\nLogical, String or Named list of vectors\n\n\nTRUE: Replace NA by an empty string.\n\n\nFALSE: Print NA as the string \"NA\".\n\n\nString: Replace NA entries by the user-supplied string.\n\n\nNamed list: Replace matching elements of the vectors in the list by theirs names. Example:\n\n\nlist(“-” = c(NA, NaN), “-∞” = -Inf, “∞” = Inf)\n\n\n\n\n\n\n\n\nescape\n\n\nLogical or \"latex\" or \"html\". If TRUE, escape special characters to display them as text in the format of the output of a tt() table.\n\n\nIf i is NULL, escape the j columns and column names.\n\n\nIf i and j are both NULL, escape all cells, column names, caption, notes, and spanning labels created by group_tt().\n\n\n\n\n\n\nmarkdown\n\n\nLogical; if TRUE, render markdown syntax in cells. Ex: italicized text is properly italicized in HTML and LaTeX.\n\n\n\n\nquarto\n\n\nLogical. Enable Quarto data processing and wrap cell content in a data-qmd span (HTML) or macro (LaTeX). Warning: Quarto data processing can enter in conflict with tinytable styling or formatting options. See global options section below.\n\n\n\n\nfn\n\n\nFunction for custom formatting. Accepts a vector and returns a character vector of the same length.\n\n\n\n\nsprintf\n\n\nString passed to the ?sprintf function to format numbers or interpolate strings with a user-defined pattern (similar to the glue package, but using Base R).\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nA data frame with formatted columns.\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- tt(dat)\nformat_tt(tab,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\n\n \n\n \n \n \n tinytable_u3ujbus1dmifd7qhrcbx\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 10 001\n 10 000\n \n \n 9 999\n 10 000\n \n \n 10 000\n 10 001\n \n \n \n \n\n \n\n \n\n\n\nk <- tt(data.frame(x = c(0.000123456789, 12.4356789)))\nformat_tt(k, digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_hosoeyap1fgvfe2hgg1t\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1, num_fmt = \"decimal\", num_zero = TRUE) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_9hkha0yd501hno9j5tr8\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.4\n 99T\n \n \n Food: Halloumi\n 201.4\n 7.3B\n \n \n Food: Tofu\n 0.1\n 29M\n \n \n Food: Beans\n 0.0\n 94K\n \n \n \n \n\n \n\n \n\n\n\ny <- tt(data.frame(x = c(123456789.678, 12435.6789)))\nformat_tt(y, digits=3, num_mark_big=\" \")\n\n \n\n \n \n \n tinytable_e1mn2m98ez4a1dfwrbc5\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 123 456 790\n \n \n 12 436\n \n \n \n \n\n \n\n \n\n\n\nx <- tt(data.frame(Text = c(\"_italicized text_\", \"__bold text__\")))\nformat_tt(x, markdown=TRUE)\n\n \n\n \n \n \n tinytable_j4e0sfn4mxnuf061ju6l\n \n \n \n \n \n\n \n \n \n \n \n \n Text\n \n \n \n \n \n italicized text\n \n \n bold text\n \n \n \n \n\n \n\n \n\n\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_ryodjjtpo5j838ps7rxa\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\ntt(dat) |> format_tt(escape = TRUE) \n\n \n\n \n \n \n tinytable_5qrapsjal9hp9p2iecoz\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>", + "text": "This function formats the columns of a data frame based on the column type (logical, date, numeric). It allows various formatting options like significant digits, decimal points, and scientific notation. It also includes custom formatting for date and boolean values. If this function is applied several times to the same cell, the last transformation is retained and the previous calls are ignored, except for the escape argument which can be applied to previously transformed data.\n\n\n\nformat_tt(\n x,\n i = NULL,\n j = NULL,\n digits = getOption(\"tinytable_format_digits\", default = NULL),\n num_fmt = getOption(\"tinytable_format_num_fmt\", default = \"significant\"),\n num_zero = getOption(\"tinytable_format_num_zero\", default = FALSE),\n num_suffix = getOption(\"tinytable_format_num_suffix\", default = FALSE),\n num_mark_big = getOption(\"tinytable_format_num_mark_big\", default = \"\"),\n num_mark_dec = getOption(\"tinytable_format_num_mark_dec\", default = getOption(\"OutDec\",\n default = \".\")),\n date = getOption(\"tinytable_format_date\", default = \"%Y-%m-%d\"),\n bool = getOption(\"tinytable_format_bool\", default = function(column)\n tools::toTitleCase(tolower(column))),\n other = getOption(\"tinytable_format_other\", default = as.character),\n replace = getOption(\"tinytable_format_replace\", default = TRUE),\n escape = getOption(\"tinytable_format_escape\", default = FALSE),\n markdown = getOption(\"tinytable_format_markdown\", default = FALSE),\n quarto = getOption(\"tinytable_format_quarto\", default = FALSE),\n fn = getOption(\"tinytable_format_fn\", default = NULL),\n sprintf = getOption(\"tinytable_format_sprintf\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\ni\n\n\nRow indices where the formatting should be applied.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be:\n\n\nInteger vectors indicating column positions.\n\n\nCharacter vector indicating column names.\n\n\nA single string specifying a Perl-style regular expression used to match column names.\n\n\n\n\n\n\ndigits\n\n\nNumber of significant digits or decimal places.\n\n\n\n\nnum_fmt\n\n\nThe format for numeric values; one of ‘significant’, ‘significant_cell’, ‘decimal’, or ‘scientific’.\n\n\n\n\nnum_zero\n\n\nLogical; if TRUE, trailing zeros are kept in \"decimal\" format (but not in \"significant\" format).\n\n\n\n\nnum_suffix\n\n\nLogical; if TRUE display short numbers with digits significant digits and K (thousands), M (millions), B (billions), or T (trillions) suffixes.\n\n\n\n\nnum_mark_big\n\n\nCharacter to use as a thousands separator.\n\n\n\n\nnum_mark_dec\n\n\nDecimal mark character. Default is the global option ‘OutDec’.\n\n\n\n\ndate\n\n\nA string passed to the format() function, such as \"%Y-%m-%d\". See the \"Details\" section in ?strptime\n\n\n\n\nbool\n\n\nA function to format logical columns. Defaults to title case.\n\n\n\n\nother\n\n\nA function to format columns of other types. Defaults to as.character().\n\n\n\n\nreplace\n\n\nLogical, String or Named list of vectors\n\n\nTRUE: Replace NA by an empty string.\n\n\nFALSE: Print NA as the string \"NA\".\n\n\nString: Replace NA entries by the user-supplied string.\n\n\nNamed list: Replace matching elements of the vectors in the list by theirs names. Example:\n\n\nlist(“-” = c(NA, NaN), “-∞” = -Inf, “∞” = Inf)\n\n\n\n\n\n\n\n\nescape\n\n\nLogical or \"latex\" or \"html\". If TRUE, escape special characters to display them as text in the format of the output of a tt() table.\n\n\nIf i is NULL, escape the j columns and column names.\n\n\nIf i and j are both NULL, escape all cells, column names, caption, notes, and spanning labels created by group_tt().\n\n\n\n\n\n\nmarkdown\n\n\nLogical; if TRUE, render markdown syntax in cells. Ex: italicized text is properly italicized in HTML and LaTeX.\n\n\n\n\nquarto\n\n\nLogical. Enable Quarto data processing and wrap cell content in a data-qmd span (HTML) or macro (LaTeX). Warning: Quarto data processing can enter in conflict with tinytable styling or formatting options. See global options section below.\n\n\n\n\nfn\n\n\nFunction for custom formatting. Accepts a vector and returns a character vector of the same length.\n\n\n\n\nsprintf\n\n\nString passed to the ?sprintf function to format numbers or interpolate strings with a user-defined pattern (similar to the glue package, but using Base R).\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nA data frame with formatted columns.\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- tt(dat)\nformat_tt(tab,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\n\n \n\n \n \n \n tinytable_jnyb4qqdm7s0k3jbt40u\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 9 999\n 10 001\n \n \n 9 999\n 10 001\n \n \n 10 000\n 10 000\n \n \n \n \n\n \n\n \n\n\n\nk <- tt(data.frame(x = c(0.000123456789, 12.4356789)))\nformat_tt(k, digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_5o15ym2a6rpp3yprifsl\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1, num_fmt = \"decimal\", num_zero = TRUE) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_pls6zso81vu535rkkv70\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.4\n 99T\n \n \n Food: Halloumi\n 201.4\n 7.3B\n \n \n Food: Tofu\n 0.1\n 29M\n \n \n Food: Beans\n 0.0\n 94K\n \n \n \n \n\n \n\n \n\n\n\ny <- tt(data.frame(x = c(123456789.678, 12435.6789)))\nformat_tt(y, digits=3, num_mark_big=\" \")\n\n \n\n \n \n \n tinytable_cjonjmu3vg1rnptk90nx\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 123 456 790\n \n \n 12 436\n \n \n \n \n\n \n\n \n\n\n\nx <- tt(data.frame(Text = c(\"_italicized text_\", \"__bold text__\")))\nformat_tt(x, markdown=TRUE)\n\n \n\n \n \n \n tinytable_pvmhboupgbw9t2fd1wj1\n \n \n \n \n \n\n \n \n \n \n \n \n Text\n \n \n \n \n \n italicized text\n \n \n bold text\n \n \n \n \n\n \n\n \n\n\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_4gehw0nf9zv3n5fya27a\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\ntt(dat) |> format_tt(escape = TRUE) \n\n \n\n \n \n \n tinytable_ecgott1pbt8jwznsjoh3\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -108,7 +108,7 @@ "href": "man/format_tt.html#format-columns-of-a-data-frame", "title": "tinytable", "section": "", - "text": "This function formats the columns of a data frame based on the column type (logical, date, numeric). It allows various formatting options like significant digits, decimal points, and scientific notation. It also includes custom formatting for date and boolean values. If this function is applied several times to the same cell, the last transformation is retained and the previous calls are ignored, except for the escape argument which can be applied to previously transformed data.\n\n\n\nformat_tt(\n x,\n i = NULL,\n j = NULL,\n digits = getOption(\"tinytable_format_digits\", default = NULL),\n num_fmt = getOption(\"tinytable_format_num_fmt\", default = \"significant\"),\n num_zero = getOption(\"tinytable_format_num_zero\", default = FALSE),\n num_suffix = getOption(\"tinytable_format_num_suffix\", default = FALSE),\n num_mark_big = getOption(\"tinytable_format_num_mark_big\", default = \"\"),\n num_mark_dec = getOption(\"tinytable_format_num_mark_dec\", default = getOption(\"OutDec\",\n default = \".\")),\n date = getOption(\"tinytable_format_date\", default = \"%Y-%m-%d\"),\n bool = getOption(\"tinytable_format_bool\", default = function(column)\n tools::toTitleCase(tolower(column))),\n other = getOption(\"tinytable_format_other\", default = as.character),\n replace = getOption(\"tinytable_format_replace\", default = TRUE),\n escape = getOption(\"tinytable_format_escape\", default = FALSE),\n markdown = getOption(\"tinytable_format_markdown\", default = FALSE),\n quarto = getOption(\"tinytable_format_quarto\", default = FALSE),\n fn = getOption(\"tinytable_format_fn\", default = NULL),\n sprintf = getOption(\"tinytable_format_sprintf\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\ni\n\n\nRow indices where the formatting should be applied.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be:\n\n\nInteger vectors indicating column positions.\n\n\nCharacter vector indicating column names.\n\n\nA single string specifying a Perl-style regular expression used to match column names.\n\n\n\n\n\n\ndigits\n\n\nNumber of significant digits or decimal places.\n\n\n\n\nnum_fmt\n\n\nThe format for numeric values; one of ‘significant’, ‘significant_cell’, ‘decimal’, or ‘scientific’.\n\n\n\n\nnum_zero\n\n\nLogical; if TRUE, trailing zeros are kept in \"decimal\" format (but not in \"significant\" format).\n\n\n\n\nnum_suffix\n\n\nLogical; if TRUE display short numbers with digits significant digits and K (thousands), M (millions), B (billions), or T (trillions) suffixes.\n\n\n\n\nnum_mark_big\n\n\nCharacter to use as a thousands separator.\n\n\n\n\nnum_mark_dec\n\n\nDecimal mark character. Default is the global option ‘OutDec’.\n\n\n\n\ndate\n\n\nA string passed to the format() function, such as \"%Y-%m-%d\". See the \"Details\" section in ?strptime\n\n\n\n\nbool\n\n\nA function to format logical columns. Defaults to title case.\n\n\n\n\nother\n\n\nA function to format columns of other types. Defaults to as.character().\n\n\n\n\nreplace\n\n\nLogical, String or Named list of vectors\n\n\nTRUE: Replace NA by an empty string.\n\n\nFALSE: Print NA as the string \"NA\".\n\n\nString: Replace NA entries by the user-supplied string.\n\n\nNamed list: Replace matching elements of the vectors in the list by theirs names. Example:\n\n\nlist(“-” = c(NA, NaN), “-∞” = -Inf, “∞” = Inf)\n\n\n\n\n\n\n\n\nescape\n\n\nLogical or \"latex\" or \"html\". If TRUE, escape special characters to display them as text in the format of the output of a tt() table.\n\n\nIf i is NULL, escape the j columns and column names.\n\n\nIf i and j are both NULL, escape all cells, column names, caption, notes, and spanning labels created by group_tt().\n\n\n\n\n\n\nmarkdown\n\n\nLogical; if TRUE, render markdown syntax in cells. Ex: italicized text is properly italicized in HTML and LaTeX.\n\n\n\n\nquarto\n\n\nLogical. Enable Quarto data processing and wrap cell content in a data-qmd span (HTML) or macro (LaTeX). Warning: Quarto data processing can enter in conflict with tinytable styling or formatting options. See global options section below.\n\n\n\n\nfn\n\n\nFunction for custom formatting. Accepts a vector and returns a character vector of the same length.\n\n\n\n\nsprintf\n\n\nString passed to the ?sprintf function to format numbers or interpolate strings with a user-defined pattern (similar to the glue package, but using Base R).\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nA data frame with formatted columns.\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- tt(dat)\nformat_tt(tab,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\n\n \n\n \n \n \n tinytable_u3ujbus1dmifd7qhrcbx\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 10 001\n 10 000\n \n \n 9 999\n 10 000\n \n \n 10 000\n 10 001\n \n \n \n \n\n \n\n \n\n\n\nk <- tt(data.frame(x = c(0.000123456789, 12.4356789)))\nformat_tt(k, digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_hosoeyap1fgvfe2hgg1t\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1, num_fmt = \"decimal\", num_zero = TRUE) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_9hkha0yd501hno9j5tr8\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.4\n 99T\n \n \n Food: Halloumi\n 201.4\n 7.3B\n \n \n Food: Tofu\n 0.1\n 29M\n \n \n Food: Beans\n 0.0\n 94K\n \n \n \n \n\n \n\n \n\n\n\ny <- tt(data.frame(x = c(123456789.678, 12435.6789)))\nformat_tt(y, digits=3, num_mark_big=\" \")\n\n \n\n \n \n \n tinytable_e1mn2m98ez4a1dfwrbc5\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 123 456 790\n \n \n 12 436\n \n \n \n \n\n \n\n \n\n\n\nx <- tt(data.frame(Text = c(\"_italicized text_\", \"__bold text__\")))\nformat_tt(x, markdown=TRUE)\n\n \n\n \n \n \n tinytable_j4e0sfn4mxnuf061ju6l\n \n \n \n \n \n\n \n \n \n \n \n \n Text\n \n \n \n \n \n italicized text\n \n \n bold text\n \n \n \n \n\n \n\n \n\n\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_ryodjjtpo5j838ps7rxa\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\ntt(dat) |> format_tt(escape = TRUE) \n\n \n\n \n \n \n tinytable_5qrapsjal9hp9p2iecoz\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>", + "text": "This function formats the columns of a data frame based on the column type (logical, date, numeric). It allows various formatting options like significant digits, decimal points, and scientific notation. It also includes custom formatting for date and boolean values. If this function is applied several times to the same cell, the last transformation is retained and the previous calls are ignored, except for the escape argument which can be applied to previously transformed data.\n\n\n\nformat_tt(\n x,\n i = NULL,\n j = NULL,\n digits = getOption(\"tinytable_format_digits\", default = NULL),\n num_fmt = getOption(\"tinytable_format_num_fmt\", default = \"significant\"),\n num_zero = getOption(\"tinytable_format_num_zero\", default = FALSE),\n num_suffix = getOption(\"tinytable_format_num_suffix\", default = FALSE),\n num_mark_big = getOption(\"tinytable_format_num_mark_big\", default = \"\"),\n num_mark_dec = getOption(\"tinytable_format_num_mark_dec\", default = getOption(\"OutDec\",\n default = \".\")),\n date = getOption(\"tinytable_format_date\", default = \"%Y-%m-%d\"),\n bool = getOption(\"tinytable_format_bool\", default = function(column)\n tools::toTitleCase(tolower(column))),\n other = getOption(\"tinytable_format_other\", default = as.character),\n replace = getOption(\"tinytable_format_replace\", default = TRUE),\n escape = getOption(\"tinytable_format_escape\", default = FALSE),\n markdown = getOption(\"tinytable_format_markdown\", default = FALSE),\n quarto = getOption(\"tinytable_format_quarto\", default = FALSE),\n fn = getOption(\"tinytable_format_fn\", default = NULL),\n sprintf = getOption(\"tinytable_format_sprintf\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\ni\n\n\nRow indices where the formatting should be applied.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be:\n\n\nInteger vectors indicating column positions.\n\n\nCharacter vector indicating column names.\n\n\nA single string specifying a Perl-style regular expression used to match column names.\n\n\n\n\n\n\ndigits\n\n\nNumber of significant digits or decimal places.\n\n\n\n\nnum_fmt\n\n\nThe format for numeric values; one of ‘significant’, ‘significant_cell’, ‘decimal’, or ‘scientific’.\n\n\n\n\nnum_zero\n\n\nLogical; if TRUE, trailing zeros are kept in \"decimal\" format (but not in \"significant\" format).\n\n\n\n\nnum_suffix\n\n\nLogical; if TRUE display short numbers with digits significant digits and K (thousands), M (millions), B (billions), or T (trillions) suffixes.\n\n\n\n\nnum_mark_big\n\n\nCharacter to use as a thousands separator.\n\n\n\n\nnum_mark_dec\n\n\nDecimal mark character. Default is the global option ‘OutDec’.\n\n\n\n\ndate\n\n\nA string passed to the format() function, such as \"%Y-%m-%d\". See the \"Details\" section in ?strptime\n\n\n\n\nbool\n\n\nA function to format logical columns. Defaults to title case.\n\n\n\n\nother\n\n\nA function to format columns of other types. Defaults to as.character().\n\n\n\n\nreplace\n\n\nLogical, String or Named list of vectors\n\n\nTRUE: Replace NA by an empty string.\n\n\nFALSE: Print NA as the string \"NA\".\n\n\nString: Replace NA entries by the user-supplied string.\n\n\nNamed list: Replace matching elements of the vectors in the list by theirs names. Example:\n\n\nlist(“-” = c(NA, NaN), “-∞” = -Inf, “∞” = Inf)\n\n\n\n\n\n\n\n\nescape\n\n\nLogical or \"latex\" or \"html\". If TRUE, escape special characters to display them as text in the format of the output of a tt() table.\n\n\nIf i is NULL, escape the j columns and column names.\n\n\nIf i and j are both NULL, escape all cells, column names, caption, notes, and spanning labels created by group_tt().\n\n\n\n\n\n\nmarkdown\n\n\nLogical; if TRUE, render markdown syntax in cells. Ex: italicized text is properly italicized in HTML and LaTeX.\n\n\n\n\nquarto\n\n\nLogical. Enable Quarto data processing and wrap cell content in a data-qmd span (HTML) or macro (LaTeX). Warning: Quarto data processing can enter in conflict with tinytable styling or formatting options. See global options section below.\n\n\n\n\nfn\n\n\nFunction for custom formatting. Accepts a vector and returns a character vector of the same length.\n\n\n\n\nsprintf\n\n\nString passed to the ?sprintf function to format numbers or interpolate strings with a user-defined pattern (similar to the glue package, but using Base R).\n\n\n\n\n…\n\n\nAdditional arguments are ignored.\n\n\n\n\n\n\nA data frame with formatted columns.\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- tt(dat)\nformat_tt(tab,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\n\n \n\n \n \n \n tinytable_jnyb4qqdm7s0k3jbt40u\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 9 999\n 10 001\n \n \n 9 999\n 10 001\n \n \n 10 000\n 10 000\n \n \n \n \n\n \n\n \n\n\n\nk <- tt(data.frame(x = c(0.000123456789, 12.4356789)))\nformat_tt(k, digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_5o15ym2a6rpp3yprifsl\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1, num_fmt = \"decimal\", num_zero = TRUE) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_pls6zso81vu535rkkv70\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.4\n 99T\n \n \n Food: Halloumi\n 201.4\n 7.3B\n \n \n Food: Tofu\n 0.1\n 29M\n \n \n Food: Beans\n 0.0\n 94K\n \n \n \n \n\n \n\n \n\n\n\ny <- tt(data.frame(x = c(123456789.678, 12435.6789)))\nformat_tt(y, digits=3, num_mark_big=\" \")\n\n \n\n \n \n \n tinytable_cjonjmu3vg1rnptk90nx\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 123 456 790\n \n \n 12 436\n \n \n \n \n\n \n\n \n\n\n\nx <- tt(data.frame(Text = c(\"_italicized text_\", \"__bold text__\")))\nformat_tt(x, markdown=TRUE)\n\n \n\n \n \n \n tinytable_pvmhboupgbw9t2fd1wj1\n \n \n \n \n \n\n \n \n \n \n \n \n Text\n \n \n \n \n \n italicized text\n \n \n bold text\n \n \n \n \n\n \n\n \n\n\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_4gehw0nf9zv3n5fya27a\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\ntt(dat) |> format_tt(escape = TRUE) \n\n \n\n \n \n \n tinytable_ecgott1pbt8jwznsjoh3\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -168,7 +168,7 @@ "href": "vignettes/custom.html", "title": "Customization", "section": "", - "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\n\n\nThe 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/\nFor example, to produce a “bordered” table, we use the table-bordered class:\n\ntt(x) |> style_tt(bootstrap_class = \"table table-bordered\")\n\n \n\n \n \n \n tinytable_qey0bwzdlwcm29htppm1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also combine several Bootstrap classes. Here, we get a table with the “hover” feature:\n\ntt(x) |> style_tt(\n bootstrap_class = \"table table-hover\")\n\n \n\n \n \n \n tinytable_ancqtjftnbrkr9n14cfy\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(x) |>\n style_tt(j = 1, bootstrap_css = \"font-weight: bold; color: red;\")\n\n \n\n \n \n \n tinytable_ota7y6lpc864yp13okh4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nFor 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.\n\ncss_rule <- \"\n.mytable {\n background: linear-gradient(45deg, #EA8D8D, #A890FE);\n width: 600px;\n border-collapse: collapse;\n overflow: hidden;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n}\n\n.mytable th,\n.mytable td {\n padding: 5px;\n background-color: rgba(255,255,255,0.2);\n color: #fff;\n}\n\n.mytable tbody tr:hover {\n background-color: rgba(255,255,255,0.3);\n}\n\n.mytable tbody td:hover:before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: -9999px;\n bottom: -9999px;\n background-color: rgba(255,255,255,0.2);\n z-index: -1;\n}\n\"\n\ntt(x, width = 2/3) |> \n style_tt(\n j = 1:5,\n align = \"ccccc\",\n bootstrap_class = \"table mytable\",\n bootstrap_css_rule = css_rule)\n\n \n\n \n \n \n tinytable_qhhag2dh0uus725wyb1b\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here’s another example:\n\ncss <- \"\n.squirreltable {\n background-size: cover;\n background-position: center;\n background-image: url('https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png');\n --bs-table-bg: transparent;\n}\n\"\n\ntt(mtcars[1:10, 1:8]) |>\n style_tt(\n bootstrap_class = \"table table-borderless squirreltable\", \n bootstrap_css_rule = css)\n\n \n\n \n \n \n tinytable_zakgiinzrlkqan6la1l0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n 19.2\n 6\n 168\n 123\n 3.92\n 3.44\n 18.3\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\n\nThe LaTeX / PDF customization options described in this section are not available for HTML documents. Please refer to the PDF documentation hosted on the website to read this part of the tutorial.\n\n\n\n\n\n\n\n\n\n\n\n\ntinytable is a great complement to Shiny for displaying HTML tables in a web app. The styling in a tinytable is applied by JavaScript functions and CSS. Thus, to ensure that this styling is preserved in a Shiny app, one strategy is to bake the entire page, save it in a temporary file, and load it using the includeHTML function from the shiny package. This approach is illustrated in this minimal example:\n\nlibrary(\"shiny\")\nlibrary(\"tinytable\")\n\nfn <- paste(tempfile(), \".html\")\ntab <- tt(mtcars[1:5, 1:4]) |> \n style_tt(i = 0:5, color = \"orange\", background = \"black\") |> \n save_tt(fn) \n\nshinyApp(\n ui = fluidPage(\n fluidRow(column(12, h1(\"This is test of tinytable\"), \n shiny::includeHTML(fn)))), \n server = function(input, output) { \n }\n)", + "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\n\n\nThe 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/\nFor example, to produce a “bordered” table, we use the table-bordered class:\n\ntt(x) |> style_tt(bootstrap_class = \"table table-bordered\")\n\n \n\n \n \n \n tinytable_mbz252apmi2qj6x4suy2\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also combine several Bootstrap classes. Here, we get a table with the “hover” feature:\n\ntt(x) |> style_tt(\n bootstrap_class = \"table table-hover\")\n\n \n\n \n \n \n tinytable_pt1baxj90y7h94kxmsxh\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(x) |>\n style_tt(j = 1, bootstrap_css = \"font-weight: bold; color: red;\")\n\n \n\n \n \n \n tinytable_nlq3wzxoly1c9g80xou9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nFor 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.\n\ncss_rule <- \"\n.mytable {\n background: linear-gradient(45deg, #EA8D8D, #A890FE);\n width: 600px;\n border-collapse: collapse;\n overflow: hidden;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n}\n\n.mytable th,\n.mytable td {\n padding: 5px;\n background-color: rgba(255,255,255,0.2);\n color: #fff;\n}\n\n.mytable tbody tr:hover {\n background-color: rgba(255,255,255,0.3);\n}\n\n.mytable tbody td:hover:before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: -9999px;\n bottom: -9999px;\n background-color: rgba(255,255,255,0.2);\n z-index: -1;\n}\n\"\n\ntt(x, width = 2/3) |> \n style_tt(\n j = 1:5,\n align = \"ccccc\",\n bootstrap_class = \"table mytable\",\n bootstrap_css_rule = css_rule)\n\n \n\n \n \n \n tinytable_p7tchtvqrfp7xdd97fdx\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here’s another example:\n\ncss <- \"\n.squirreltable {\n background-size: cover;\n background-position: center;\n background-image: url('https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png');\n --bs-table-bg: transparent;\n}\n\"\n\ntt(mtcars[1:10, 1:8]) |>\n style_tt(\n bootstrap_class = \"table table-borderless squirreltable\", \n bootstrap_css_rule = css)\n\n \n\n \n \n \n tinytable_0i2agg8y8egcc5a1i5np\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n 19.2\n 6\n 168\n 123\n 3.92\n 3.44\n 18.3\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\n\nThe LaTeX / PDF customization options described in this section are not available for HTML documents. Please refer to the PDF documentation hosted on the website to read this part of the tutorial.\n\n\n\n\n\n\n\n\n\n\n\n\ntinytable is a great complement to Shiny for displaying HTML tables in a web app. The styling in a tinytable is applied by JavaScript functions and CSS. Thus, to ensure that this styling is preserved in a Shiny app, one strategy is to bake the entire page, save it in a temporary file, and load it using the includeHTML function from the shiny package. This approach is illustrated in this minimal example:\n\nlibrary(\"shiny\")\nlibrary(\"tinytable\")\n\nfn <- paste(tempfile(), \".html\")\ntab <- tt(mtcars[1:5, 1:4]) |> \n style_tt(i = 0:5, color = \"orange\", background = \"black\") |> \n save_tt(fn) \n\nshinyApp(\n ui = fluidPage(\n fluidRow(column(12, h1(\"This is test of tinytable\"), \n shiny::includeHTML(fn)))), \n server = function(input, output) { \n }\n)", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -180,7 +180,7 @@ "href": "vignettes/custom.html#html", "title": "Customization", "section": "", - "text": "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/\nFor example, to produce a “bordered” table, we use the table-bordered class:\n\ntt(x) |> style_tt(bootstrap_class = \"table table-bordered\")\n\n \n\n \n \n \n tinytable_qey0bwzdlwcm29htppm1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also combine several Bootstrap classes. Here, we get a table with the “hover” feature:\n\ntt(x) |> style_tt(\n bootstrap_class = \"table table-hover\")\n\n \n\n \n \n \n tinytable_ancqtjftnbrkr9n14cfy\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(x) |>\n style_tt(j = 1, bootstrap_css = \"font-weight: bold; color: red;\")\n\n \n\n \n \n \n tinytable_ota7y6lpc864yp13okh4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nFor 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.\n\ncss_rule <- \"\n.mytable {\n background: linear-gradient(45deg, #EA8D8D, #A890FE);\n width: 600px;\n border-collapse: collapse;\n overflow: hidden;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n}\n\n.mytable th,\n.mytable td {\n padding: 5px;\n background-color: rgba(255,255,255,0.2);\n color: #fff;\n}\n\n.mytable tbody tr:hover {\n background-color: rgba(255,255,255,0.3);\n}\n\n.mytable tbody td:hover:before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: -9999px;\n bottom: -9999px;\n background-color: rgba(255,255,255,0.2);\n z-index: -1;\n}\n\"\n\ntt(x, width = 2/3) |> \n style_tt(\n j = 1:5,\n align = \"ccccc\",\n bootstrap_class = \"table mytable\",\n bootstrap_css_rule = css_rule)\n\n \n\n \n \n \n tinytable_qhhag2dh0uus725wyb1b\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here’s another example:\n\ncss <- \"\n.squirreltable {\n background-size: cover;\n background-position: center;\n background-image: url('https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png');\n --bs-table-bg: transparent;\n}\n\"\n\ntt(mtcars[1:10, 1:8]) |>\n style_tt(\n bootstrap_class = \"table table-borderless squirreltable\", \n bootstrap_css_rule = css)\n\n \n\n \n \n \n tinytable_zakgiinzrlkqan6la1l0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n 19.2\n 6\n 168\n 123\n 3.92\n 3.44\n 18.3\n 1", + "text": "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/\nFor example, to produce a “bordered” table, we use the table-bordered class:\n\ntt(x) |> style_tt(bootstrap_class = \"table table-bordered\")\n\n \n\n \n \n \n tinytable_mbz252apmi2qj6x4suy2\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also combine several Bootstrap classes. Here, we get a table with the “hover” feature:\n\ntt(x) |> style_tt(\n bootstrap_class = \"table table-hover\")\n\n \n\n \n \n \n tinytable_pt1baxj90y7h94kxmsxh\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(x) |>\n style_tt(j = 1, bootstrap_css = \"font-weight: bold; color: red;\")\n\n \n\n \n \n \n tinytable_nlq3wzxoly1c9g80xou9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nFor 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.\n\ncss_rule <- \"\n.mytable {\n background: linear-gradient(45deg, #EA8D8D, #A890FE);\n width: 600px;\n border-collapse: collapse;\n overflow: hidden;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n}\n\n.mytable th,\n.mytable td {\n padding: 5px;\n background-color: rgba(255,255,255,0.2);\n color: #fff;\n}\n\n.mytable tbody tr:hover {\n background-color: rgba(255,255,255,0.3);\n}\n\n.mytable tbody td:hover:before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: -9999px;\n bottom: -9999px;\n background-color: rgba(255,255,255,0.2);\n z-index: -1;\n}\n\"\n\ntt(x, width = 2/3) |> \n style_tt(\n j = 1:5,\n align = \"ccccc\",\n bootstrap_class = \"table mytable\",\n bootstrap_css_rule = css_rule)\n\n \n\n \n \n \n tinytable_p7tchtvqrfp7xdd97fdx\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here’s another example:\n\ncss <- \"\n.squirreltable {\n background-size: cover;\n background-position: center;\n background-image: url('https://user-images.githubusercontent.com/987057/82732352-b9aabf00-9cda-11ea-92a6-26750cf097d0.png');\n --bs-table-bg: transparent;\n}\n\"\n\ntt(mtcars[1:10, 1:8]) |>\n style_tt(\n bootstrap_class = \"table table-borderless squirreltable\", \n bootstrap_css_rule = css)\n\n \n\n \n \n \n tinytable_0i2agg8y8egcc5a1i5np\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n 19.2\n 6\n 168\n 123\n 3.92\n 3.44\n 18.3\n 1", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -216,7 +216,7 @@ "href": "vignettes/plot.html", "title": "Plots and images", "section": "", - "text": "The plot_tt() function can embed images and plots in a tinytable. We can insert images by specifying their paths and positions (i/j).\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo 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.\n\ndat <- data.frame(\n Species = c(\"Spider\", \"Squirrel\"),\n Image = \"\"\n)\n\nimg <- c(\n \"../figures/spider.png\",\n \"../figures/squirrel.png\"\n)\n\ntt(dat) |>\n plot_tt(j = 2, images = img, height = 3)\n\n \n\n \n \n \n tinytable_va035ttx2715evru9a1u\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Image\n \n \n \n \n \n Spider \n \n \n \n Squirrel\n \n \n \n \n \n\n \n\n \n\n\n\n\nIn HTML tables, it is possible to insert tables directly from a web address, but not in LaTeX.\n\ndat <- data.frame(\"R\" = \"\")\nimg <- \"https://cran.r-project.org/Rlogo.svg\"\ntt(dat) |>\n plot_tt(i = 1, j = 1, images = img, height = 7) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_e931k0fbocnxch53045u\n \n \n \n \n \n\n \n \n \n \n \n \n R\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nWe can draw inline plots three ways, with\n\nBuilt-in templates for histograms, density plots, and bar plots\nCustom plots using base R plots.\nCustom plots using ggplot2.\n\nTo draw custom plots, one simply has to define a custom function, whose structure we illustrate below.\n\n\nThere are several types of inline plots available by default. For example,\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(\n Variables = c(\"mpg\", \"hp\", \"qsec\"), \n Histogram = \"\",\n Density = \"\",\n Bar = \"\",\n Line = \"\"\n)\n\n# random data for sparklines\nlines <- lapply(1:3, \\(x) data.frame(x = 1:10, y = rnorm(10)))\n\ntt(dat) |>\n plot_tt(j = 2, fun = \"histogram\", data = plot_data) |>\n plot_tt(j = 3, fun = \"density\", data = plot_data, color = \"darkgreen\") |>\n plot_tt(j = 4, fun = \"bar\", data = list(2, 3, 6), color = \"orange\") |>\n plot_tt(j = 5, fun = \"line\", data = lines, color = \"blue\") |>\n style_tt(j = 2:5, align = \"c\")\n\n \n\n \n \n \n tinytable_xbdwib94rf8koqoekm23\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n Line\n \n \n \n \n \n mpg \n \n \n \n \n \n \n hp \n \n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using Base R plotting functions, we create a function that returns another function. tinytable will then call that second function internally to generate the plot.\nThis is easier than it sounds! For example:\n\nf <- function(d, ...) {\n function() hist(d, axes = FALSE, ann = FALSE, col = \"lightblue\")\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(Variables = c(\"mpg\", \"hp\", \"qsec\"), Histogram = \"\")\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data)\n\n \n\n \n \n \n tinytable_ita7kfe0gu3uuyvguomw\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using ggplot2, we create a function that returns a ggplot object:\n\nlibrary(ggplot2)\n\nf <- function(d, color = \"black\", ...) {\n d <- data.frame(x = d)\n ggplot(d, aes(x = x)) + \n geom_histogram(bins = 30, color = color, fill = color) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n theme_void()\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data, color = \"pink\")\n\n \n\n \n \n \n tinytable_iqfnqg5qby0iho6mgdos\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\nWe can insert arbitrarily complex plots by customizing the ggplot2 call:\n\npenguins <- read.csv(\n \"https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv\",\n na.strings = \"\") |> na.omit()\n\n# split data by species\ndat <- split(penguins, penguins$species)\nbody <- lapply(dat, \\(x) x$body_mass_g)\nflip <- lapply(dat, \\(x) x$flipper_length_mm)\n\n# create nearly empty table\ntab <- data.frame(\n \"Species\" = names(dat),\n \"Body Mass\" = \"\",\n \"Flipper Length\" = \"\",\n \"Body vs. Flipper\" = \"\",\n check.names = FALSE\n)\n\n# custom ggplot2 function to create inline plot\nf <- function(d, ...) {\n ggplot(d, aes(x = flipper_length_mm, y = body_mass_g, color = sex)) +\n geom_point(size = .2) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n scale_color_manual(values = c(\"#E69F00\", \"#56B4E9\")) +\n theme_void() +\n theme(legend.position = \"none\")\n}\n\n# `tinytable` calls\ntt(tab) |>\n plot_tt(j = 2, fun = \"histogram\", data = body, height = 2) |>\n plot_tt(j = 3, fun = \"density\", data = flip, height = 2) |>\n plot_tt(j = 4, fun = f, data = dat, height = 2) |>\n style_tt(j = 2:4, align = \"c\") \n\n \n\n \n \n \n tinytable_7hjdscf2wfs0e7n515vm\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Body Mass\n Flipper Length\n Body vs. Flipper\n \n \n \n \n \n Adelie \n \n \n \n \n \n Chinstrap\n \n \n \n \n \n Gentoo \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\n\nWe can use the fontawesome package to include fancy icons in HTML tables:\n\nlibrary(fontawesome)\ntmp <- mtcars[1:4, 1:4]\ntmp[1, 1] <- paste(fa(\"r-project\"), \"for statistics\")\ntt(tmp)\n\n \n\n \n \n \n tinytable_e8bqdll88mnrty72bg6x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n for statistics\n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8 \n 4\n 108\n 93 \n \n \n 21.4 \n 6\n 258\n 110", + "text": "The plot_tt() function can embed images and plots in a tinytable. We can insert images by specifying their paths and positions (i/j).\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo 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.\n\ndat <- data.frame(\n Species = c(\"Spider\", \"Squirrel\"),\n Image = \"\"\n)\n\nimg <- c(\n \"../figures/spider.png\",\n \"../figures/squirrel.png\"\n)\n\ntt(dat) |>\n plot_tt(j = 2, images = img, height = 3)\n\n \n\n \n \n \n tinytable_eljwmp9fn522wllp9e0u\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Image\n \n \n \n \n \n Spider \n \n \n \n Squirrel\n \n \n \n \n \n\n \n\n \n\n\n\n\nIn HTML tables, it is possible to insert tables directly from a web address, but not in LaTeX.\n\ndat <- data.frame(\"R\" = \"\")\nimg <- \"https://cran.r-project.org/Rlogo.svg\"\ntt(dat) |>\n plot_tt(i = 1, j = 1, images = img, height = 7) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_hxouydii56944jdt0z32\n \n \n \n \n \n\n \n \n \n \n \n \n R\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nWe can draw inline plots three ways, with\n\nBuilt-in templates for histograms, density plots, and bar plots\nCustom plots using base R plots.\nCustom plots using ggplot2.\n\nTo draw custom plots, one simply has to define a custom function, whose structure we illustrate below.\n\n\nThere are several types of inline plots available by default. For example,\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(\n Variables = c(\"mpg\", \"hp\", \"qsec\"), \n Histogram = \"\",\n Density = \"\",\n Bar = \"\",\n Line = \"\"\n)\n\n# random data for sparklines\nlines <- lapply(1:3, \\(x) data.frame(x = 1:10, y = rnorm(10)))\n\ntt(dat) |>\n plot_tt(j = 2, fun = \"histogram\", data = plot_data) |>\n plot_tt(j = 3, fun = \"density\", data = plot_data, color = \"darkgreen\") |>\n plot_tt(j = 4, fun = \"bar\", data = list(2, 3, 6), color = \"orange\") |>\n plot_tt(j = 5, fun = \"line\", data = lines, color = \"blue\") |>\n style_tt(j = 2:5, align = \"c\")\n\n \n\n \n \n \n tinytable_8apahn2sq8lk2gs4m7ig\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n Line\n \n \n \n \n \n mpg \n \n \n \n \n \n \n hp \n \n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using Base R plotting functions, we create a function that returns another function. tinytable will then call that second function internally to generate the plot.\nThis is easier than it sounds! For example:\n\nf <- function(d, ...) {\n function() hist(d, axes = FALSE, ann = FALSE, col = \"lightblue\")\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(Variables = c(\"mpg\", \"hp\", \"qsec\"), Histogram = \"\")\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data)\n\n \n\n \n \n \n tinytable_tp8l38jlk6m4riv40151\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using ggplot2, we create a function that returns a ggplot object:\n\nlibrary(ggplot2)\n\nf <- function(d, color = \"black\", ...) {\n d <- data.frame(x = d)\n ggplot(d, aes(x = x)) + \n geom_histogram(bins = 30, color = color, fill = color) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n theme_void()\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data, color = \"pink\")\n\n \n\n \n \n \n tinytable_rc9l8680yz12idlkrks4\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\nWe can insert arbitrarily complex plots by customizing the ggplot2 call:\n\npenguins <- read.csv(\n \"https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv\",\n na.strings = \"\") |> na.omit()\n\n# split data by species\ndat <- split(penguins, penguins$species)\nbody <- lapply(dat, \\(x) x$body_mass_g)\nflip <- lapply(dat, \\(x) x$flipper_length_mm)\n\n# create nearly empty table\ntab <- data.frame(\n \"Species\" = names(dat),\n \"Body Mass\" = \"\",\n \"Flipper Length\" = \"\",\n \"Body vs. Flipper\" = \"\",\n check.names = FALSE\n)\n\n# custom ggplot2 function to create inline plot\nf <- function(d, ...) {\n ggplot(d, aes(x = flipper_length_mm, y = body_mass_g, color = sex)) +\n geom_point(size = .2) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n scale_color_manual(values = c(\"#E69F00\", \"#56B4E9\")) +\n theme_void() +\n theme(legend.position = \"none\")\n}\n\n# `tinytable` calls\ntt(tab) |>\n plot_tt(j = 2, fun = \"histogram\", data = body, height = 2) |>\n plot_tt(j = 3, fun = \"density\", data = flip, height = 2) |>\n plot_tt(j = 4, fun = f, data = dat, height = 2) |>\n style_tt(j = 2:4, align = \"c\") \n\n \n\n \n \n \n tinytable_yjab7h6j6q1zr3l9se80\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Body Mass\n Flipper Length\n Body vs. Flipper\n \n \n \n \n \n Adelie \n \n \n \n \n \n Chinstrap\n \n \n \n \n \n Gentoo \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\n\nWe can use the fontawesome package to include fancy icons in HTML tables:\n\nlibrary(fontawesome)\ntmp <- mtcars[1:4, 1:4]\ntmp[1, 1] <- paste(fa(\"r-project\"), \"for statistics\")\ntt(tmp)\n\n \n\n \n \n \n tinytable_kkor365kddq4y2n1qybn\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n for statistics\n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8 \n 4\n 108\n 93 \n \n \n 21.4 \n 6\n 258\n 110", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -228,7 +228,7 @@ "href": "vignettes/plot.html#inserting-images-in-tables", "title": "Plots and images", "section": "", - "text": "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.\n\ndat <- data.frame(\n Species = c(\"Spider\", \"Squirrel\"),\n Image = \"\"\n)\n\nimg <- c(\n \"../figures/spider.png\",\n \"../figures/squirrel.png\"\n)\n\ntt(dat) |>\n plot_tt(j = 2, images = img, height = 3)\n\n \n\n \n \n \n tinytable_va035ttx2715evru9a1u\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Image\n \n \n \n \n \n Spider \n \n \n \n Squirrel\n \n \n \n \n \n\n \n\n \n\n\n\n\nIn HTML tables, it is possible to insert tables directly from a web address, but not in LaTeX.\n\ndat <- data.frame(\"R\" = \"\")\nimg <- \"https://cran.r-project.org/Rlogo.svg\"\ntt(dat) |>\n plot_tt(i = 1, j = 1, images = img, height = 7) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_e931k0fbocnxch53045u\n \n \n \n \n \n\n \n \n \n \n \n \n R", + "text": "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.\n\ndat <- data.frame(\n Species = c(\"Spider\", \"Squirrel\"),\n Image = \"\"\n)\n\nimg <- c(\n \"../figures/spider.png\",\n \"../figures/squirrel.png\"\n)\n\ntt(dat) |>\n plot_tt(j = 2, images = img, height = 3)\n\n \n\n \n \n \n tinytable_eljwmp9fn522wllp9e0u\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Image\n \n \n \n \n \n Spider \n \n \n \n Squirrel\n \n \n \n \n \n\n \n\n \n\n\n\n\nIn HTML tables, it is possible to insert tables directly from a web address, but not in LaTeX.\n\ndat <- data.frame(\"R\" = \"\")\nimg <- \"https://cran.r-project.org/Rlogo.svg\"\ntt(dat) |>\n plot_tt(i = 1, j = 1, images = img, height = 7) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_hxouydii56944jdt0z32\n \n \n \n \n \n\n \n \n \n \n \n \n R", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -240,7 +240,7 @@ "href": "vignettes/plot.html#inline-plots", "title": "Plots and images", "section": "", - "text": "We can draw inline plots three ways, with\n\nBuilt-in templates for histograms, density plots, and bar plots\nCustom plots using base R plots.\nCustom plots using ggplot2.\n\nTo draw custom plots, one simply has to define a custom function, whose structure we illustrate below.\n\n\nThere are several types of inline plots available by default. For example,\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(\n Variables = c(\"mpg\", \"hp\", \"qsec\"), \n Histogram = \"\",\n Density = \"\",\n Bar = \"\",\n Line = \"\"\n)\n\n# random data for sparklines\nlines <- lapply(1:3, \\(x) data.frame(x = 1:10, y = rnorm(10)))\n\ntt(dat) |>\n plot_tt(j = 2, fun = \"histogram\", data = plot_data) |>\n plot_tt(j = 3, fun = \"density\", data = plot_data, color = \"darkgreen\") |>\n plot_tt(j = 4, fun = \"bar\", data = list(2, 3, 6), color = \"orange\") |>\n plot_tt(j = 5, fun = \"line\", data = lines, color = \"blue\") |>\n style_tt(j = 2:5, align = \"c\")\n\n \n\n \n \n \n tinytable_xbdwib94rf8koqoekm23\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n Line\n \n \n \n \n \n mpg \n \n \n \n \n \n \n hp \n \n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using Base R plotting functions, we create a function that returns another function. tinytable will then call that second function internally to generate the plot.\nThis is easier than it sounds! For example:\n\nf <- function(d, ...) {\n function() hist(d, axes = FALSE, ann = FALSE, col = \"lightblue\")\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(Variables = c(\"mpg\", \"hp\", \"qsec\"), Histogram = \"\")\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data)\n\n \n\n \n \n \n tinytable_ita7kfe0gu3uuyvguomw\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using ggplot2, we create a function that returns a ggplot object:\n\nlibrary(ggplot2)\n\nf <- function(d, color = \"black\", ...) {\n d <- data.frame(x = d)\n ggplot(d, aes(x = x)) + \n geom_histogram(bins = 30, color = color, fill = color) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n theme_void()\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data, color = \"pink\")\n\n \n\n \n \n \n tinytable_iqfnqg5qby0iho6mgdos\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\nWe can insert arbitrarily complex plots by customizing the ggplot2 call:\n\npenguins <- read.csv(\n \"https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv\",\n na.strings = \"\") |> na.omit()\n\n# split data by species\ndat <- split(penguins, penguins$species)\nbody <- lapply(dat, \\(x) x$body_mass_g)\nflip <- lapply(dat, \\(x) x$flipper_length_mm)\n\n# create nearly empty table\ntab <- data.frame(\n \"Species\" = names(dat),\n \"Body Mass\" = \"\",\n \"Flipper Length\" = \"\",\n \"Body vs. Flipper\" = \"\",\n check.names = FALSE\n)\n\n# custom ggplot2 function to create inline plot\nf <- function(d, ...) {\n ggplot(d, aes(x = flipper_length_mm, y = body_mass_g, color = sex)) +\n geom_point(size = .2) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n scale_color_manual(values = c(\"#E69F00\", \"#56B4E9\")) +\n theme_void() +\n theme(legend.position = \"none\")\n}\n\n# `tinytable` calls\ntt(tab) |>\n plot_tt(j = 2, fun = \"histogram\", data = body, height = 2) |>\n plot_tt(j = 3, fun = \"density\", data = flip, height = 2) |>\n plot_tt(j = 4, fun = f, data = dat, height = 2) |>\n style_tt(j = 2:4, align = \"c\") \n\n \n\n \n \n \n tinytable_7hjdscf2wfs0e7n515vm\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Body Mass\n Flipper Length\n Body vs. Flipper\n \n \n \n \n \n Adelie \n \n \n \n \n \n Chinstrap\n \n \n \n \n \n Gentoo", + "text": "We can draw inline plots three ways, with\n\nBuilt-in templates for histograms, density plots, and bar plots\nCustom plots using base R plots.\nCustom plots using ggplot2.\n\nTo draw custom plots, one simply has to define a custom function, whose structure we illustrate below.\n\n\nThere are several types of inline plots available by default. For example,\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(\n Variables = c(\"mpg\", \"hp\", \"qsec\"), \n Histogram = \"\",\n Density = \"\",\n Bar = \"\",\n Line = \"\"\n)\n\n# random data for sparklines\nlines <- lapply(1:3, \\(x) data.frame(x = 1:10, y = rnorm(10)))\n\ntt(dat) |>\n plot_tt(j = 2, fun = \"histogram\", data = plot_data) |>\n plot_tt(j = 3, fun = \"density\", data = plot_data, color = \"darkgreen\") |>\n plot_tt(j = 4, fun = \"bar\", data = list(2, 3, 6), color = \"orange\") |>\n plot_tt(j = 5, fun = \"line\", data = lines, color = \"blue\") |>\n style_tt(j = 2:5, align = \"c\")\n\n \n\n \n \n \n tinytable_8apahn2sq8lk2gs4m7ig\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n Line\n \n \n \n \n \n mpg \n \n \n \n \n \n \n hp \n \n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using Base R plotting functions, we create a function that returns another function. tinytable will then call that second function internally to generate the plot.\nThis is easier than it sounds! For example:\n\nf <- function(d, ...) {\n function() hist(d, axes = FALSE, ann = FALSE, col = \"lightblue\")\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ndat <- data.frame(Variables = c(\"mpg\", \"hp\", \"qsec\"), Histogram = \"\")\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data)\n\n \n\n \n \n \n tinytable_tp8l38jlk6m4riv40151\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nImportant: Custom functions must have ... as an argument.\nTo create a custom inline plot using ggplot2, we create a function that returns a ggplot object:\n\nlibrary(ggplot2)\n\nf <- function(d, color = \"black\", ...) {\n d <- data.frame(x = d)\n ggplot(d, aes(x = x)) + \n geom_histogram(bins = 30, color = color, fill = color) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n theme_void()\n}\n\nplot_data <- list(mtcars$mpg, mtcars$hp, mtcars$qsec)\n\ntt(dat) |>\n plot_tt(j = 2, fun = f, data = plot_data, color = \"pink\")\n\n \n\n \n \n \n tinytable_rc9l8680yz12idlkrks4\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n \n \n \n \n \n mpg \n \n \n \n hp \n \n \n \n qsec\n \n \n \n \n \n\n \n\n \n\n\n\n\nWe can insert arbitrarily complex plots by customizing the ggplot2 call:\n\npenguins <- read.csv(\n \"https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv\",\n na.strings = \"\") |> na.omit()\n\n# split data by species\ndat <- split(penguins, penguins$species)\nbody <- lapply(dat, \\(x) x$body_mass_g)\nflip <- lapply(dat, \\(x) x$flipper_length_mm)\n\n# create nearly empty table\ntab <- data.frame(\n \"Species\" = names(dat),\n \"Body Mass\" = \"\",\n \"Flipper Length\" = \"\",\n \"Body vs. Flipper\" = \"\",\n check.names = FALSE\n)\n\n# custom ggplot2 function to create inline plot\nf <- function(d, ...) {\n ggplot(d, aes(x = flipper_length_mm, y = body_mass_g, color = sex)) +\n geom_point(size = .2) +\n scale_x_continuous(expand=c(0,0)) +\n scale_y_continuous(expand=c(0,0)) +\n scale_color_manual(values = c(\"#E69F00\", \"#56B4E9\")) +\n theme_void() +\n theme(legend.position = \"none\")\n}\n\n# `tinytable` calls\ntt(tab) |>\n plot_tt(j = 2, fun = \"histogram\", data = body, height = 2) |>\n plot_tt(j = 3, fun = \"density\", data = flip, height = 2) |>\n plot_tt(j = 4, fun = f, data = dat, height = 2) |>\n style_tt(j = 2:4, align = \"c\") \n\n \n\n \n \n \n tinytable_yjab7h6j6q1zr3l9se80\n \n \n \n \n \n\n \n \n \n \n \n \n Species\n Body Mass\n Flipper Length\n Body vs. Flipper\n \n \n \n \n \n Adelie \n \n \n \n \n \n Chinstrap\n \n \n \n \n \n Gentoo", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -252,7 +252,7 @@ "href": "vignettes/plot.html#fontawesome", "title": "Plots and images", "section": "", - "text": "We can use the fontawesome package to include fancy icons in HTML tables:\n\nlibrary(fontawesome)\ntmp <- mtcars[1:4, 1:4]\ntmp[1, 1] <- paste(fa(\"r-project\"), \"for statistics\")\ntt(tmp)\n\n \n\n \n \n \n tinytable_e8bqdll88mnrty72bg6x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n for statistics\n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8 \n 4\n 108\n 93 \n \n \n 21.4 \n 6\n 258\n 110", + "text": "We can use the fontawesome package to include fancy icons in HTML tables:\n\nlibrary(fontawesome)\ntmp <- mtcars[1:4, 1:4]\ntmp[1, 1] <- paste(fa(\"r-project\"), \"for statistics\")\ntt(tmp)\n\n \n\n \n \n \n tinytable_kkor365kddq4y2n1qybn\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n for statistics\n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8 \n 4\n 108\n 93 \n \n \n 21.4 \n 6\n 258\n 110", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -264,7 +264,7 @@ "href": "vignettes/format.html", "title": "Formatting", "section": "", - "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nThe tt() function is minimalist; it’s inteded purpose is simply to draw nice tables. Users who want to format numbers, dates, strings, and other variables in different ways should process their data before supplying it to the tt() table-drawing function. To do so, we can use the format_tt() function supplied by the tinytable.\nIn a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():\n\ndat <- data.frame(\n w = c(143002.2092, 201399.181, 100188.3883),\n x = c(1.43402, 201.399, 0.134588),\n y = as.Date(sample(1:1000, 3), origin = \"1970-01-01\"),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_zdua259kt2yu95pwqe4m\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143002\n 1.43\n 1970-06-08\n True \n \n \n 201399\n 201.4 \n 1970-06-03\n True \n \n \n 100188\n 0.13\n 1970-06-19\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:\n\ntt(dat) |> \n format_tt(\n j = 2:4,\n digits = 1,\n date = \"%B %d %Y\") |>\n format_tt(\n j = 1,\n digits = 2,\n num_mark_big = \" \",\n num_mark_dec = \",\",\n num_fmt = \"decimal\")\n\n \n\n \n \n \n tinytable_kppfum0vfdcgovspi5gq\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143 002,21\n 1.4\n June 08 1970\n True\n \n \n 201 399,18\n 201.4\n June 03 1970\n True\n \n \n 100 188,39\n 0.1\n June 19 1970\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can use a regular expression in j to select columns, and the ?sprintf function to format strings, numbers, and to do string interpolation (similar to the glue package, but using Base R):\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_hg5j352ctx2bz486vprd\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.432\n 99T\n \n \n Food: Halloumi\n 201.399\n 7.3B\n \n \n Food: Tofu\n 0.146\n 29M\n \n \n Food: Beans\n 0.003\n 94K\n \n \n \n \n\n \n\n \n\n\n\n\nFinally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:\n\nformat_tt(pi, digits = 1)\n\n[1] \"3\"\n\nformat_tt(dat, digits = 1, num_suffix = TRUE)\n\n a b c\n1 Burger 1 99T\n2 Halloumi 201 7B\n3 Tofu 0.1 29M\n4 Beans 0.003 94K\n\n\n\n\n\nBy default, format_tt() formats numbers to ensure that the smallest value in a vector (column) has at least a certain number of significant digits. For example,\n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits = 2)\n\n \n\n \n \n \n tinytable_ww1fznmnu132vz6e196t\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568\n \n \n \n \n\n \n\n \n\n\n\n\nWe can alter this behavior to ensure to round significant digits on a per-cell basis, using the num_fmt argument in format_tt():\n\ntt(k) |> format_tt(digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_wjce5tkw8zf41qh1d42v\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\n\nThe numeric formatting options in format_tt() can also be controlled using global options:\n\noptions(\"tinytable_tt_digits\" = 2)\noptions(\"tinytable_format_num_fmt\" = \"significant_cell\")\ntt(k)\n\n \n\n \n \n \n tinytable_5893179da5gmdjel0ybd\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12 \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nMissing values can be replaced by a custom string using the replace argument (default \"\"):\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\n\ntt(tab)\n\n \n\n \n \n \n tinytable_6b9l79dm0bcko7ytlp94\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n NA\n 3\n \n \n 1\n NA\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt()\n\n \n\n \n \n \n tinytable_6iqqt6mk20b29jfqxzub\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n \n 3\n \n \n 1\n \n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_y65rtpywmzgv1qz9fupm\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also specify multiple value replacements at once using a named list of vectors:\n\ntmp <- data.frame(x = 1:5, y = c(pi, NA, NaN, -Inf, Inf))\ndict <- list(\"-\" = c(NA, NaN), \"-∞\" = -Inf, \"∞\" = Inf)\ntt(tmp) |> format_tt(replace = dict, digits = 2)\n\n \n\n \n \n \n tinytable_s7yrhfkgsbwu3xh7ln2c\n \n \n \n \n \n\n \n \n \n \n \n \n x\n y\n \n \n \n \n \n 1\n 3.1\n \n \n 2\n -\n \n \n 3\n -\n \n \n 4\n -∞\n \n \n 5\n ∞\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nLaTeX and HTML use special characters to indicate strings which should be interpreted rather than displayed as text. For example, including underscores or dollar signs in LaTeX can cause compilation errors in some documents. To display those special characters, we need to substitute or escape them with backslashes, depending on the output format. The escape argument of format_tt() can be used to do this automatically:\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\n\ntt(dat) |> format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_3schrkdnz46tw4asyzey\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>\n \n \n \n \n\n \n\n \n\n\n\n\nWhen applied to a tt() table, format_tt() will determine the type of escaping to do automatically. When applied to a string or vector, we must specify the type of escaping to apply:\n\nformat_tt(\"_ Dollars $\", escape = \"latex\")\n\n[1] \"\\\\_ Dollars \\\\$\"\n\n\n\n\n\nMarkdown can be rendered in cells by using the markdown argument of the format_tt() function (note: this requires installing the markdown as an optional dependency).\n\ndat <- data.frame( markdown = c(\n \"This is _italic_ text.\",\n \"This sentence ends with a superscript.^2^\")\n)\n\ntt(dat) |>\n format_tt(j = 1, markdown = TRUE) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_bybi75z41qdzqg95watd\n \n \n \n \n \n\n \n \n \n \n \n \n markdown\n \n \n \n \n \n This is italic text.\n \n \n This sentence ends with a superscript.2\n \n \n \n \n\n \n\n \n\n\n\n\nMarkdown syntax can be particularly useful when formatting URLs in a table:\n\ndat <- data.frame(\n `Package (link)` = c(\n \"[`marginaleffects`](https://www.marginaleffects.com/)\",\n \"[`modelsummary`](https://www.modelsummary.com/)\",\n \"[`tinytable`](https://vincentarelbundock.github.io/tinytable/)\",\n \"[`countrycode`](https://vincentarelbundock.github.io/countrycode/)\",\n \"[`WDI`](https://vincentarelbundock.github.io/WDI/)\",\n \"[`softbib`](https://vincentarelbundock.github.io/softbib/)\",\n \"[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)\",\n \"[`altdoc`](https://etiennebacher.github.io/altdoc/)\",\n \"[`plot2`](https://grantmcdermott.com/plot2/)\",\n \"[`parameters`](https://easystats.github.io/parameters/)\",\n \"[`insight`](https://easystats.github.io/insight/)\"\n ),\n Purpose = c(\n \"Interpreting statistical models\",\n \"Data and model summaries\",\n \"Draw beautiful tables easily\",\n \"Convert country codes and names\",\n \"Download data from the World Bank\",\n \"Software bibliographies in R\",\n \"Snapshots for unit tests using `tinytest`\",\n \"Create documentation website for R packages\",\n \"Extension of base R plot functions\",\n \"Extract from model objects\",\n \"Extract information from model objects\"\n ),\n check.names = FALSE\n)\n\ntt(dat) |> format_tt(j = 1, markdown = TRUE)\n\n \n\n \n \n \n tinytable_k984dcvk53pe12ocpuik\n \n \n \n \n \n\n \n \n Vincent sometimes contributes to these R packages.\n \n \n \n Package (link)\n Purpose\n \n \n \n \n \n marginaleffects\n Interpreting statistical models \n \n \n modelsummary\n Data and model summaries \n \n \n tinytable\n Draw beautiful tables easily \n \n \n countrycode\n Convert country codes and names \n \n \n WDI\n Download data from the World Bank \n \n \n softbib\n Software bibliographies in R \n \n \n tinysnapshot\n Snapshots for unit tests using `tinytest` \n \n \n altdoc\n Create documentation website for R packages\n \n \n plot2\n Extension of base R plot functions \n \n \n parameters\n Extract from model objects \n \n \n insight\n Extract information from model objects \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOn top of the built-in features of format_tt, a custom formatting function can be specified via the fn argument. The fn argument takes a function that accepts a single vector and returns a string (or something that coerces to a string like a number).\n\ntt(x) |> \n format_tt(j = \"mpg\", fn = function(x) paste0(x, \" mpg\")) |>\n format_tt(j = \"drat\", fn = \\(x) signif(x, 2))\n\n \n\n \n \n \n tinytable_gykrl062tpkhsi8jo5uq\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 22.8 mpg\n 4\n 108\n 93\n 3.8\n \n \n 21.4 mpg\n 6\n 258\n 110\n 3.1\n \n \n \n \n\n \n\n \n\n\n\n\nFor example, the scales package which is used internally by ggplot2 provides a bunch of useful tools for formatting (e.g. dates, numbers, percents, logs, currencies, etc.). The label_*() functions can be passed to the fn argument.\nNote that we call format_tt(escape = TRUE) at the end of the pipeline because the column names and cells include characters that need to be escaped in LaTeX: _, %, and $. This last call is superfluous in HTML.\n\nthumbdrives <- data.frame(\n date_lookup = as.Date(c(\"2024-01-15\", \"2024-01-18\", \"2024-01-14\", \"2024-01-16\")),\n price = c(18.49, 19.99, 24.99, 24.99),\n price_rank = c(1, 2, 3, 3),\n memory = c(16e9, 12e9, 10e9, 8e9),\n speed_benchmark = c(0.6, 0.73, 0.82, 0.99)\n)\n\ntt(thumbdrives) |>\n format_tt(j = 1, fn = scales::label_date(\"%e %b\", locale = \"fr\")) |>\n format_tt(j = 2, fn = scales::label_currency()) |>\n format_tt(j = 3, fn = scales::label_ordinal()) |> \n format_tt(j = 4, fn = scales::label_bytes()) |> \n format_tt(j = 5, fn = scales::label_percent()) |>\n format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_fntht2ix1fgr34r9px06\n \n \n \n \n \n\n \n \n \n \n \n \n date_lookup\n price\n price_rank\n memory\n speed_benchmark\n \n \n \n \n \n 2024-01-15\n $18.49\n 1st\n 16 GB\n 60%\n \n \n 2024-01-18\n $19.99\n 2nd\n 12 GB\n 73%\n \n \n 2024-01-14\n $24.99\n 3rd\n 10 GB\n 82%\n \n \n 2024-01-16\n $24.99\n 3rd\n 8 GB\n 99%\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nQuarto automatically applies some data processing to the content of the tables it renders. By default, tinytable disables this processing, because it can enter in conflict with styling and formatting features of the package.\nTo enable Quarto data processing, we can use the quarto argument of the format_tt() function. This argument allows users to mark certain cells explicitly for processing by Quarto, by wrapping them in a special “span” called “data-qmd”, supported by Quarto:\n\nk <- data.frame(Thing = \"qwerty\", Citation = \"@Lovelace1842\")\n\ntt(k) |> format_tt(quarto = TRUE)\n\n\n \n\n \n \n \n tinytable_ev6fb5hp08hfa2rjvvx6\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nSome users may want to apply Quarto data processing to all tables. This can be done with themes:\n\ntheme_quarto <- function(x) format_tt(x, quarto = TRUE)\noptions(tinytable_tt_theme = theme_quarto)\n\ntt(k)\n\n\n \n\n \n \n \n tinytable_y5xcn8b8g5tkskdyzv73\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nBack to normal:\n\noptions(tinytable_tt_theme = NULL)\n\nAlternatively, users can set a global option to process all tables in Quarto, but they will then have to mark each cell with special content using format_tt(quarto):\n\noptions(tinytable_quarto_disable_processing = FALSE)\n\ntt(x)\n\n\n \n\n \n \n \n tinytable_m001jxqkiz9gtkkiynq0\n \n \n \n \n \n\n \n \n \n\n\n\nmpg\ncyl\ndisp\nhp\ndrat\n\n\n\n\n21.0\n6\n160\n110\n3.90\n\n\n21.0\n6\n160\n110\n3.90\n\n\n22.8\n4\n108\n93\n3.85\n\n\n21.4\n6\n258\n110\n3.08\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nNotice that Quarto is now processing the table, so we lose the default tinytable theme and get the default striped Quarto look.\nBack to normal:\n\noptions(tinytable_quarto_disable_processing = TRUE)", + "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nThe tt() function is minimalist; it’s inteded purpose is simply to draw nice tables. Users who want to format numbers, dates, strings, and other variables in different ways should process their data before supplying it to the tt() table-drawing function. To do so, we can use the format_tt() function supplied by the tinytable.\nIn a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():\n\ndat <- data.frame(\n w = c(143002.2092, 201399.181, 100188.3883),\n x = c(1.43402, 201.399, 0.134588),\n y = as.Date(sample(1:1000, 3), origin = \"1970-01-01\"),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_4ymol27jr5f26sk5ftlo\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143002\n 1.43\n 1971-05-25\n True \n \n \n 201399\n 201.4 \n 1972-06-02\n True \n \n \n 100188\n 0.13\n 1970-10-13\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:\n\ntt(dat) |> \n format_tt(\n j = 2:4,\n digits = 1,\n date = \"%B %d %Y\") |>\n format_tt(\n j = 1,\n digits = 2,\n num_mark_big = \" \",\n num_mark_dec = \",\",\n num_fmt = \"decimal\")\n\n \n\n \n \n \n tinytable_oa44uzcgfxkwkfjdyt3h\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143 002,21\n 1.4\n May 25 1971\n True\n \n \n 201 399,18\n 201.4\n June 02 1972\n True\n \n \n 100 188,39\n 0.1\n October 13 1970\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can use a regular expression in j to select columns, and the ?sprintf function to format strings, numbers, and to do string interpolation (similar to the glue package, but using Base R):\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_v36w9pwcadojo4czjyku\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.432\n 99T\n \n \n Food: Halloumi\n 201.399\n 7.3B\n \n \n Food: Tofu\n 0.146\n 29M\n \n \n Food: Beans\n 0.003\n 94K\n \n \n \n \n\n \n\n \n\n\n\n\nFinally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:\n\nformat_tt(pi, digits = 1)\n\n[1] \"3\"\n\nformat_tt(dat, digits = 1, num_suffix = TRUE)\n\n a b c\n1 Burger 1 99T\n2 Halloumi 201 7B\n3 Tofu 0.1 29M\n4 Beans 0.003 94K\n\n\n\n\n\nBy default, format_tt() formats numbers to ensure that the smallest value in a vector (column) has at least a certain number of significant digits. For example,\n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits = 2)\n\n \n\n \n \n \n tinytable_vls2tzmtlv0f0kbgr4yt\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568\n \n \n \n \n\n \n\n \n\n\n\n\nWe can alter this behavior to ensure to round significant digits on a per-cell basis, using the num_fmt argument in format_tt():\n\ntt(k) |> format_tt(digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_k14z57d7g2n4istgg2eg\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\n\nThe numeric formatting options in format_tt() can also be controlled using global options:\n\noptions(\"tinytable_tt_digits\" = 2)\noptions(\"tinytable_format_num_fmt\" = \"significant_cell\")\ntt(k)\n\n \n\n \n \n \n tinytable_j43u4ln7a43jdtol4fof\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12 \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nMissing values can be replaced by a custom string using the replace argument (default \"\"):\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\n\ntt(tab)\n\n \n\n \n \n \n tinytable_aiiw0my7qdy5fuj550st\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n NA\n 3\n \n \n 1\n NA\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt()\n\n \n\n \n \n \n tinytable_t1ilnss3dvkaqnugtna2\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n \n 3\n \n \n 1\n \n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_y6zqwbtdc0iniiyx9bvx\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also specify multiple value replacements at once using a named list of vectors:\n\ntmp <- data.frame(x = 1:5, y = c(pi, NA, NaN, -Inf, Inf))\ndict <- list(\"-\" = c(NA, NaN), \"-∞\" = -Inf, \"∞\" = Inf)\ntt(tmp) |> format_tt(replace = dict, digits = 2)\n\n \n\n \n \n \n tinytable_1rnyit5zco5jiovumvz8\n \n \n \n \n \n\n \n \n \n \n \n \n x\n y\n \n \n \n \n \n 1\n 3.1\n \n \n 2\n -\n \n \n 3\n -\n \n \n 4\n -∞\n \n \n 5\n ∞\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nLaTeX and HTML use special characters to indicate strings which should be interpreted rather than displayed as text. For example, including underscores or dollar signs in LaTeX can cause compilation errors in some documents. To display those special characters, we need to substitute or escape them with backslashes, depending on the output format. The escape argument of format_tt() can be used to do this automatically:\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\n\ntt(dat) |> format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_kv44qr4xgq2yx1xufkgu\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>\n \n \n \n \n\n \n\n \n\n\n\n\nWhen applied to a tt() table, format_tt() will determine the type of escaping to do automatically. When applied to a string or vector, we must specify the type of escaping to apply:\n\nformat_tt(\"_ Dollars $\", escape = \"latex\")\n\n[1] \"\\\\_ Dollars \\\\$\"\n\n\n\n\n\nMarkdown can be rendered in cells by using the markdown argument of the format_tt() function (note: this requires installing the markdown as an optional dependency).\n\ndat <- data.frame( markdown = c(\n \"This is _italic_ text.\",\n \"This sentence ends with a superscript.^2^\")\n)\n\ntt(dat) |>\n format_tt(j = 1, markdown = TRUE) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_yovyblxolxl539n8uvn1\n \n \n \n \n \n\n \n \n \n \n \n \n markdown\n \n \n \n \n \n This is italic text.\n \n \n This sentence ends with a superscript.2\n \n \n \n \n\n \n\n \n\n\n\n\nMarkdown syntax can be particularly useful when formatting URLs in a table:\n\ndat <- data.frame(\n `Package (link)` = c(\n \"[`marginaleffects`](https://www.marginaleffects.com/)\",\n \"[`modelsummary`](https://www.modelsummary.com/)\",\n \"[`tinytable`](https://vincentarelbundock.github.io/tinytable/)\",\n \"[`countrycode`](https://vincentarelbundock.github.io/countrycode/)\",\n \"[`WDI`](https://vincentarelbundock.github.io/WDI/)\",\n \"[`softbib`](https://vincentarelbundock.github.io/softbib/)\",\n \"[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)\",\n \"[`altdoc`](https://etiennebacher.github.io/altdoc/)\",\n \"[`plot2`](https://grantmcdermott.com/plot2/)\",\n \"[`parameters`](https://easystats.github.io/parameters/)\",\n \"[`insight`](https://easystats.github.io/insight/)\"\n ),\n Purpose = c(\n \"Interpreting statistical models\",\n \"Data and model summaries\",\n \"Draw beautiful tables easily\",\n \"Convert country codes and names\",\n \"Download data from the World Bank\",\n \"Software bibliographies in R\",\n \"Snapshots for unit tests using `tinytest`\",\n \"Create documentation website for R packages\",\n \"Extension of base R plot functions\",\n \"Extract from model objects\",\n \"Extract information from model objects\"\n ),\n check.names = FALSE\n)\n\ntt(dat) |> format_tt(j = 1, markdown = TRUE)\n\n \n\n \n \n \n tinytable_nhw5lo3wyuxde5cabftd\n \n \n \n \n \n\n \n \n Vincent sometimes contributes to these R packages.\n \n \n \n Package (link)\n Purpose\n \n \n \n \n \n marginaleffects\n Interpreting statistical models \n \n \n modelsummary\n Data and model summaries \n \n \n tinytable\n Draw beautiful tables easily \n \n \n countrycode\n Convert country codes and names \n \n \n WDI\n Download data from the World Bank \n \n \n softbib\n Software bibliographies in R \n \n \n tinysnapshot\n Snapshots for unit tests using `tinytest` \n \n \n altdoc\n Create documentation website for R packages\n \n \n plot2\n Extension of base R plot functions \n \n \n parameters\n Extract from model objects \n \n \n insight\n Extract information from model objects \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOn top of the built-in features of format_tt, a custom formatting function can be specified via the fn argument. The fn argument takes a function that accepts a single vector and returns a string (or something that coerces to a string like a number).\n\ntt(x) |> \n format_tt(j = \"mpg\", fn = function(x) paste0(x, \" mpg\")) |>\n format_tt(j = \"drat\", fn = \\(x) signif(x, 2))\n\n \n\n \n \n \n tinytable_silq74avnb6va0sucsf3\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 22.8 mpg\n 4\n 108\n 93\n 3.8\n \n \n 21.4 mpg\n 6\n 258\n 110\n 3.1\n \n \n \n \n\n \n\n \n\n\n\n\nFor example, the scales package which is used internally by ggplot2 provides a bunch of useful tools for formatting (e.g. dates, numbers, percents, logs, currencies, etc.). The label_*() functions can be passed to the fn argument.\nNote that we call format_tt(escape = TRUE) at the end of the pipeline because the column names and cells include characters that need to be escaped in LaTeX: _, %, and $. This last call is superfluous in HTML.\n\nthumbdrives <- data.frame(\n date_lookup = as.Date(c(\"2024-01-15\", \"2024-01-18\", \"2024-01-14\", \"2024-01-16\")),\n price = c(18.49, 19.99, 24.99, 24.99),\n price_rank = c(1, 2, 3, 3),\n memory = c(16e9, 12e9, 10e9, 8e9),\n speed_benchmark = c(0.6, 0.73, 0.82, 0.99)\n)\n\ntt(thumbdrives) |>\n format_tt(j = 1, fn = scales::label_date(\"%e %b\", locale = \"fr\")) |>\n format_tt(j = 2, fn = scales::label_currency()) |>\n format_tt(j = 3, fn = scales::label_ordinal()) |> \n format_tt(j = 4, fn = scales::label_bytes()) |> \n format_tt(j = 5, fn = scales::label_percent()) |>\n format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_3kuouuerzo2ch3qj9q6j\n \n \n \n \n \n\n \n \n \n \n \n \n date_lookup\n price\n price_rank\n memory\n speed_benchmark\n \n \n \n \n \n 2024-01-15\n $18.49\n 1st\n 16 GB\n 60%\n \n \n 2024-01-18\n $19.99\n 2nd\n 12 GB\n 73%\n \n \n 2024-01-14\n $24.99\n 3rd\n 10 GB\n 82%\n \n \n 2024-01-16\n $24.99\n 3rd\n 8 GB\n 99%\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nQuarto automatically applies some data processing to the content of the tables it renders. By default, tinytable disables this processing, because it can enter in conflict with styling and formatting features of the package.\nTo enable Quarto data processing, we can use the quarto argument of the format_tt() function. This argument allows users to mark certain cells explicitly for processing by Quarto, by wrapping them in a special “span” called “data-qmd”, supported by Quarto:\n\nk <- data.frame(Thing = \"qwerty\", Citation = \"@Lovelace1842\")\n\ntt(k) |> format_tt(quarto = TRUE)\n\n\n \n\n \n \n \n tinytable_1stc1657mskghbxeoctl\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nSome users may want to apply Quarto data processing to all tables. This can be done with themes:\n\ntheme_quarto <- function(x) format_tt(x, quarto = TRUE)\noptions(tinytable_tt_theme = theme_quarto)\n\ntt(k)\n\n\n \n\n \n \n \n tinytable_bsrx6lzsyl6efxf35xx0\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nBack to normal:\n\noptions(tinytable_tt_theme = NULL)\n\nAlternatively, users can set a global option to process all tables in Quarto, but they will then have to mark each cell with special content using format_tt(quarto):\n\noptions(tinytable_quarto_disable_processing = FALSE)\n\ntt(x)\n\n\n \n\n \n \n \n tinytable_zw9dj20cqv2u15qnm5mj\n \n \n \n \n \n\n \n \n \n\n\n\nmpg\ncyl\ndisp\nhp\ndrat\n\n\n\n\n21.0\n6\n160\n110\n3.90\n\n\n21.0\n6\n160\n110\n3.90\n\n\n22.8\n4\n108\n93\n3.85\n\n\n21.4\n6\n258\n110\n3.08\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nNotice that Quarto is now processing the table, so we lose the default tinytable theme and get the default striped Quarto look.\nBack to normal:\n\noptions(tinytable_quarto_disable_processing = TRUE)", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -276,7 +276,7 @@ "href": "vignettes/format.html#numbers-dates-strings-etc.", "title": "Formatting", "section": "", - "text": "The tt() function is minimalist; it’s inteded purpose is simply to draw nice tables. Users who want to format numbers, dates, strings, and other variables in different ways should process their data before supplying it to the tt() table-drawing function. To do so, we can use the format_tt() function supplied by the tinytable.\nIn a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():\n\ndat <- data.frame(\n w = c(143002.2092, 201399.181, 100188.3883),\n x = c(1.43402, 201.399, 0.134588),\n y = as.Date(sample(1:1000, 3), origin = \"1970-01-01\"),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_zdua259kt2yu95pwqe4m\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143002\n 1.43\n 1970-06-08\n True \n \n \n 201399\n 201.4 \n 1970-06-03\n True \n \n \n 100188\n 0.13\n 1970-06-19\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:\n\ntt(dat) |> \n format_tt(\n j = 2:4,\n digits = 1,\n date = \"%B %d %Y\") |>\n format_tt(\n j = 1,\n digits = 2,\n num_mark_big = \" \",\n num_mark_dec = \",\",\n num_fmt = \"decimal\")\n\n \n\n \n \n \n tinytable_kppfum0vfdcgovspi5gq\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143 002,21\n 1.4\n June 08 1970\n True\n \n \n 201 399,18\n 201.4\n June 03 1970\n True\n \n \n 100 188,39\n 0.1\n June 19 1970\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can use a regular expression in j to select columns, and the ?sprintf function to format strings, numbers, and to do string interpolation (similar to the glue package, but using Base R):\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_hg5j352ctx2bz486vprd\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.432\n 99T\n \n \n Food: Halloumi\n 201.399\n 7.3B\n \n \n Food: Tofu\n 0.146\n 29M\n \n \n Food: Beans\n 0.003\n 94K\n \n \n \n \n\n \n\n \n\n\n\n\nFinally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:\n\nformat_tt(pi, digits = 1)\n\n[1] \"3\"\n\nformat_tt(dat, digits = 1, num_suffix = TRUE)\n\n a b c\n1 Burger 1 99T\n2 Halloumi 201 7B\n3 Tofu 0.1 29M\n4 Beans 0.003 94K", + "text": "The tt() function is minimalist; it’s inteded purpose is simply to draw nice tables. Users who want to format numbers, dates, strings, and other variables in different ways should process their data before supplying it to the tt() table-drawing function. To do so, we can use the format_tt() function supplied by the tinytable.\nIn a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():\n\ndat <- data.frame(\n w = c(143002.2092, 201399.181, 100188.3883),\n x = c(1.43402, 201.399, 0.134588),\n y = as.Date(sample(1:1000, 3), origin = \"1970-01-01\"),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_4ymol27jr5f26sk5ftlo\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143002\n 1.43\n 1971-05-25\n True \n \n \n 201399\n 201.4 \n 1972-06-02\n True \n \n \n 100188\n 0.13\n 1970-10-13\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:\n\ntt(dat) |> \n format_tt(\n j = 2:4,\n digits = 1,\n date = \"%B %d %Y\") |>\n format_tt(\n j = 1,\n digits = 2,\n num_mark_big = \" \",\n num_mark_dec = \",\",\n num_fmt = \"decimal\")\n\n \n\n \n \n \n tinytable_oa44uzcgfxkwkfjdyt3h\n \n \n \n \n \n\n \n \n \n \n \n \n w\n x\n y\n z\n \n \n \n \n \n 143 002,21\n 1.4\n May 25 1971\n True\n \n \n 201 399,18\n 201.4\n June 02 1972\n True\n \n \n 100 188,39\n 0.1\n October 13 1970\n False\n \n \n \n \n\n \n\n \n\n\n\n\nWe can use a regular expression in j to select columns, and the ?sprintf function to format strings, numbers, and to do string interpolation (similar to the glue package, but using Base R):\n\ndat <- data.frame(\n a = c(\"Burger\", \"Halloumi\", \"Tofu\", \"Beans\"),\n b = c(1.43202, 201.399, 0.146188, 0.0031),\n c = c(98938272783457, 7288839482, 29111727, 93945))\ntt(dat) |>\n format_tt(j = \"a\", sprintf = \"Food: %s\") |>\n format_tt(j = 2, digits = 1) |>\n format_tt(j = \"c\", digits = 2, num_suffix = TRUE)\n\n \n\n \n \n \n tinytable_v36w9pwcadojo4czjyku\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n Food: Burger\n 1.432\n 99T\n \n \n Food: Halloumi\n 201.399\n 7.3B\n \n \n Food: Tofu\n 0.146\n 29M\n \n \n Food: Beans\n 0.003\n 94K\n \n \n \n \n\n \n\n \n\n\n\n\nFinally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:\n\nformat_tt(pi, digits = 1)\n\n[1] \"3\"\n\nformat_tt(dat, digits = 1, num_suffix = TRUE)\n\n a b c\n1 Burger 1 99T\n2 Halloumi 201 7B\n3 Tofu 0.1 29M\n4 Beans 0.003 94K", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -288,7 +288,7 @@ "href": "vignettes/format.html#significant-digits-and-decimals", "title": "Formatting", "section": "", - "text": "By default, format_tt() formats numbers to ensure that the smallest value in a vector (column) has at least a certain number of significant digits. For example,\n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits = 2)\n\n \n\n \n \n \n tinytable_ww1fznmnu132vz6e196t\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568\n \n \n \n \n\n \n\n \n\n\n\n\nWe can alter this behavior to ensure to round significant digits on a per-cell basis, using the num_fmt argument in format_tt():\n\ntt(k) |> format_tt(digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_wjce5tkw8zf41qh1d42v\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\n\nThe numeric formatting options in format_tt() can also be controlled using global options:\n\noptions(\"tinytable_tt_digits\" = 2)\noptions(\"tinytable_format_num_fmt\" = \"significant_cell\")\ntt(k)\n\n \n\n \n \n \n tinytable_5893179da5gmdjel0ybd\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12", + "text": "By default, format_tt() formats numbers to ensure that the smallest value in a vector (column) has at least a certain number of significant digits. For example,\n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits = 2)\n\n \n\n \n \n \n tinytable_vls2tzmtlv0f0kbgr4yt\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568\n \n \n \n \n\n \n\n \n\n\n\n\nWe can alter this behavior to ensure to round significant digits on a per-cell basis, using the num_fmt argument in format_tt():\n\ntt(k) |> format_tt(digits = 2, num_fmt = \"significant_cell\")\n\n \n\n \n \n \n tinytable_k14z57d7g2n4istgg2eg\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12\n \n \n \n \n\n \n\n \n\n\n\n\nThe numeric formatting options in format_tt() can also be controlled using global options:\n\noptions(\"tinytable_tt_digits\" = 2)\noptions(\"tinytable_format_num_fmt\" = \"significant_cell\")\ntt(k)\n\n \n\n \n \n \n tinytable_j43u4ln7a43jdtol4fof\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -300,7 +300,7 @@ "href": "vignettes/format.html#replacement", "title": "Formatting", "section": "", - "text": "Missing values can be replaced by a custom string using the replace argument (default \"\"):\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\n\ntt(tab)\n\n \n\n \n \n \n tinytable_6b9l79dm0bcko7ytlp94\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n NA\n 3\n \n \n 1\n NA\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt()\n\n \n\n \n \n \n tinytable_6iqqt6mk20b29jfqxzub\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n \n 3\n \n \n 1\n \n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_y65rtpywmzgv1qz9fupm\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also specify multiple value replacements at once using a named list of vectors:\n\ntmp <- data.frame(x = 1:5, y = c(pi, NA, NaN, -Inf, Inf))\ndict <- list(\"-\" = c(NA, NaN), \"-∞\" = -Inf, \"∞\" = Inf)\ntt(tmp) |> format_tt(replace = dict, digits = 2)\n\n \n\n \n \n \n tinytable_s7yrhfkgsbwu3xh7ln2c\n \n \n \n \n \n\n \n \n \n \n \n \n x\n y\n \n \n \n \n \n 1\n 3.1\n \n \n 2\n -\n \n \n 3\n -\n \n \n 4\n -∞\n \n \n 5\n ∞", + "text": "Missing values can be replaced by a custom string using the replace argument (default \"\"):\n\ntab <- data.frame(a = c(NA, 1, 2), b = c(3, NA, 5))\n\ntt(tab)\n\n \n\n \n \n \n tinytable_aiiw0my7qdy5fuj550st\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n NA\n 3\n \n \n 1\n NA\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt()\n\n \n\n \n \n \n tinytable_t1ilnss3dvkaqnugtna2\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n \n 3\n \n \n 1\n \n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\ntt(tab) |> format_tt(replace = \"-\")\n\n \n\n \n \n \n tinytable_y6zqwbtdc0iniiyx9bvx\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n -\n 3\n \n \n 1\n -\n \n \n 2\n 5\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also specify multiple value replacements at once using a named list of vectors:\n\ntmp <- data.frame(x = 1:5, y = c(pi, NA, NaN, -Inf, Inf))\ndict <- list(\"-\" = c(NA, NaN), \"-∞\" = -Inf, \"∞\" = Inf)\ntt(tmp) |> format_tt(replace = dict, digits = 2)\n\n \n\n \n \n \n tinytable_1rnyit5zco5jiovumvz8\n \n \n \n \n \n\n \n \n \n \n \n \n x\n y\n \n \n \n \n \n 1\n 3.1\n \n \n 2\n -\n \n \n 3\n -\n \n \n 4\n -∞\n \n \n 5\n ∞", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -312,7 +312,7 @@ "href": "vignettes/format.html#escape-special-characters", "title": "Formatting", "section": "", - "text": "LaTeX and HTML use special characters to indicate strings which should be interpreted rather than displayed as text. For example, including underscores or dollar signs in LaTeX can cause compilation errors in some documents. To display those special characters, we need to substitute or escape them with backslashes, depending on the output format. The escape argument of format_tt() can be used to do this automatically:\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\n\ntt(dat) |> format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_3schrkdnz46tw4asyzey\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>\n \n \n \n \n\n \n\n \n\n\n\n\nWhen applied to a tt() table, format_tt() will determine the type of escaping to do automatically. When applied to a string or vector, we must specify the type of escaping to apply:\n\nformat_tt(\"_ Dollars $\", escape = \"latex\")\n\n[1] \"\\\\_ Dollars \\\\$\"", + "text": "LaTeX and HTML use special characters to indicate strings which should be interpreted rather than displayed as text. For example, including underscores or dollar signs in LaTeX can cause compilation errors in some documents. To display those special characters, we need to substitute or escape them with backslashes, depending on the output format. The escape argument of format_tt() can be used to do this automatically:\n\ndat <- data.frame(\n \"LaTeX\" = c(\"Dollars $\", \"Percent %\", \"Underscore _\"),\n \"HTML\" = c(\"<br>\", \"<sup>4</sup>\", \"<emph>blah</emph>\")\n)\n\ntt(dat) |> format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_kv44qr4xgq2yx1xufkgu\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX\n HTML\n \n \n \n \n \n Dollars $\n <br>\n \n \n Percent %\n <sup>4</sup>\n \n \n Underscore _\n <emph>blah</emph>\n \n \n \n \n\n \n\n \n\n\n\n\nWhen applied to a tt() table, format_tt() will determine the type of escaping to do automatically. When applied to a string or vector, we must specify the type of escaping to apply:\n\nformat_tt(\"_ Dollars $\", escape = \"latex\")\n\n[1] \"\\\\_ Dollars \\\\$\"", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -324,7 +324,7 @@ "href": "vignettes/format.html#markdown", "title": "Formatting", "section": "", - "text": "Markdown can be rendered in cells by using the markdown argument of the format_tt() function (note: this requires installing the markdown as an optional dependency).\n\ndat <- data.frame( markdown = c(\n \"This is _italic_ text.\",\n \"This sentence ends with a superscript.^2^\")\n)\n\ntt(dat) |>\n format_tt(j = 1, markdown = TRUE) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_bybi75z41qdzqg95watd\n \n \n \n \n \n\n \n \n \n \n \n \n markdown\n \n \n \n \n \n This is italic text.\n \n \n This sentence ends with a superscript.2\n \n \n \n \n\n \n\n \n\n\n\n\nMarkdown syntax can be particularly useful when formatting URLs in a table:\n\ndat <- data.frame(\n `Package (link)` = c(\n \"[`marginaleffects`](https://www.marginaleffects.com/)\",\n \"[`modelsummary`](https://www.modelsummary.com/)\",\n \"[`tinytable`](https://vincentarelbundock.github.io/tinytable/)\",\n \"[`countrycode`](https://vincentarelbundock.github.io/countrycode/)\",\n \"[`WDI`](https://vincentarelbundock.github.io/WDI/)\",\n \"[`softbib`](https://vincentarelbundock.github.io/softbib/)\",\n \"[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)\",\n \"[`altdoc`](https://etiennebacher.github.io/altdoc/)\",\n \"[`plot2`](https://grantmcdermott.com/plot2/)\",\n \"[`parameters`](https://easystats.github.io/parameters/)\",\n \"[`insight`](https://easystats.github.io/insight/)\"\n ),\n Purpose = c(\n \"Interpreting statistical models\",\n \"Data and model summaries\",\n \"Draw beautiful tables easily\",\n \"Convert country codes and names\",\n \"Download data from the World Bank\",\n \"Software bibliographies in R\",\n \"Snapshots for unit tests using `tinytest`\",\n \"Create documentation website for R packages\",\n \"Extension of base R plot functions\",\n \"Extract from model objects\",\n \"Extract information from model objects\"\n ),\n check.names = FALSE\n)\n\ntt(dat) |> format_tt(j = 1, markdown = TRUE)\n\n \n\n \n \n \n tinytable_k984dcvk53pe12ocpuik\n \n \n \n \n \n\n \n \n Vincent sometimes contributes to these R packages.\n \n \n \n Package (link)\n Purpose\n \n \n \n \n \n marginaleffects\n Interpreting statistical models \n \n \n modelsummary\n Data and model summaries \n \n \n tinytable\n Draw beautiful tables easily \n \n \n countrycode\n Convert country codes and names \n \n \n WDI\n Download data from the World Bank \n \n \n softbib\n Software bibliographies in R \n \n \n tinysnapshot\n Snapshots for unit tests using `tinytest` \n \n \n altdoc\n Create documentation website for R packages\n \n \n plot2\n Extension of base R plot functions \n \n \n parameters\n Extract from model objects \n \n \n insight\n Extract information from model objects", + "text": "Markdown can be rendered in cells by using the markdown argument of the format_tt() function (note: this requires installing the markdown as an optional dependency).\n\ndat <- data.frame( markdown = c(\n \"This is _italic_ text.\",\n \"This sentence ends with a superscript.^2^\")\n)\n\ntt(dat) |>\n format_tt(j = 1, markdown = TRUE) |>\n style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_yovyblxolxl539n8uvn1\n \n \n \n \n \n\n \n \n \n \n \n \n markdown\n \n \n \n \n \n This is italic text.\n \n \n This sentence ends with a superscript.2\n \n \n \n \n\n \n\n \n\n\n\n\nMarkdown syntax can be particularly useful when formatting URLs in a table:\n\ndat <- data.frame(\n `Package (link)` = c(\n \"[`marginaleffects`](https://www.marginaleffects.com/)\",\n \"[`modelsummary`](https://www.modelsummary.com/)\",\n \"[`tinytable`](https://vincentarelbundock.github.io/tinytable/)\",\n \"[`countrycode`](https://vincentarelbundock.github.io/countrycode/)\",\n \"[`WDI`](https://vincentarelbundock.github.io/WDI/)\",\n \"[`softbib`](https://vincentarelbundock.github.io/softbib/)\",\n \"[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)\",\n \"[`altdoc`](https://etiennebacher.github.io/altdoc/)\",\n \"[`plot2`](https://grantmcdermott.com/plot2/)\",\n \"[`parameters`](https://easystats.github.io/parameters/)\",\n \"[`insight`](https://easystats.github.io/insight/)\"\n ),\n Purpose = c(\n \"Interpreting statistical models\",\n \"Data and model summaries\",\n \"Draw beautiful tables easily\",\n \"Convert country codes and names\",\n \"Download data from the World Bank\",\n \"Software bibliographies in R\",\n \"Snapshots for unit tests using `tinytest`\",\n \"Create documentation website for R packages\",\n \"Extension of base R plot functions\",\n \"Extract from model objects\",\n \"Extract information from model objects\"\n ),\n check.names = FALSE\n)\n\ntt(dat) |> format_tt(j = 1, markdown = TRUE)\n\n \n\n \n \n \n tinytable_nhw5lo3wyuxde5cabftd\n \n \n \n \n \n\n \n \n Vincent sometimes contributes to these R packages.\n \n \n \n Package (link)\n Purpose\n \n \n \n \n \n marginaleffects\n Interpreting statistical models \n \n \n modelsummary\n Data and model summaries \n \n \n tinytable\n Draw beautiful tables easily \n \n \n countrycode\n Convert country codes and names \n \n \n WDI\n Download data from the World Bank \n \n \n softbib\n Software bibliographies in R \n \n \n tinysnapshot\n Snapshots for unit tests using `tinytest` \n \n \n altdoc\n Create documentation website for R packages\n \n \n plot2\n Extension of base R plot functions \n \n \n parameters\n Extract from model objects \n \n \n insight\n Extract information from model objects", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -336,7 +336,7 @@ "href": "vignettes/format.html#custom-functions", "title": "Formatting", "section": "", - "text": "On top of the built-in features of format_tt, a custom formatting function can be specified via the fn argument. The fn argument takes a function that accepts a single vector and returns a string (or something that coerces to a string like a number).\n\ntt(x) |> \n format_tt(j = \"mpg\", fn = function(x) paste0(x, \" mpg\")) |>\n format_tt(j = \"drat\", fn = \\(x) signif(x, 2))\n\n \n\n \n \n \n tinytable_gykrl062tpkhsi8jo5uq\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 22.8 mpg\n 4\n 108\n 93\n 3.8\n \n \n 21.4 mpg\n 6\n 258\n 110\n 3.1\n \n \n \n \n\n \n\n \n\n\n\n\nFor example, the scales package which is used internally by ggplot2 provides a bunch of useful tools for formatting (e.g. dates, numbers, percents, logs, currencies, etc.). The label_*() functions can be passed to the fn argument.\nNote that we call format_tt(escape = TRUE) at the end of the pipeline because the column names and cells include characters that need to be escaped in LaTeX: _, %, and $. This last call is superfluous in HTML.\n\nthumbdrives <- data.frame(\n date_lookup = as.Date(c(\"2024-01-15\", \"2024-01-18\", \"2024-01-14\", \"2024-01-16\")),\n price = c(18.49, 19.99, 24.99, 24.99),\n price_rank = c(1, 2, 3, 3),\n memory = c(16e9, 12e9, 10e9, 8e9),\n speed_benchmark = c(0.6, 0.73, 0.82, 0.99)\n)\n\ntt(thumbdrives) |>\n format_tt(j = 1, fn = scales::label_date(\"%e %b\", locale = \"fr\")) |>\n format_tt(j = 2, fn = scales::label_currency()) |>\n format_tt(j = 3, fn = scales::label_ordinal()) |> \n format_tt(j = 4, fn = scales::label_bytes()) |> \n format_tt(j = 5, fn = scales::label_percent()) |>\n format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_fntht2ix1fgr34r9px06\n \n \n \n \n \n\n \n \n \n \n \n \n date_lookup\n price\n price_rank\n memory\n speed_benchmark\n \n \n \n \n \n 2024-01-15\n $18.49\n 1st\n 16 GB\n 60%\n \n \n 2024-01-18\n $19.99\n 2nd\n 12 GB\n 73%\n \n \n 2024-01-14\n $24.99\n 3rd\n 10 GB\n 82%\n \n \n 2024-01-16\n $24.99\n 3rd\n 8 GB\n 99%", + "text": "On top of the built-in features of format_tt, a custom formatting function can be specified via the fn argument. The fn argument takes a function that accepts a single vector and returns a string (or something that coerces to a string like a number).\n\ntt(x) |> \n format_tt(j = \"mpg\", fn = function(x) paste0(x, \" mpg\")) |>\n format_tt(j = \"drat\", fn = \\(x) signif(x, 2))\n\n \n\n \n \n \n tinytable_silq74avnb6va0sucsf3\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 21 mpg\n 6\n 160\n 110\n 3.9\n \n \n 22.8 mpg\n 4\n 108\n 93\n 3.8\n \n \n 21.4 mpg\n 6\n 258\n 110\n 3.1\n \n \n \n \n\n \n\n \n\n\n\n\nFor example, the scales package which is used internally by ggplot2 provides a bunch of useful tools for formatting (e.g. dates, numbers, percents, logs, currencies, etc.). The label_*() functions can be passed to the fn argument.\nNote that we call format_tt(escape = TRUE) at the end of the pipeline because the column names and cells include characters that need to be escaped in LaTeX: _, %, and $. This last call is superfluous in HTML.\n\nthumbdrives <- data.frame(\n date_lookup = as.Date(c(\"2024-01-15\", \"2024-01-18\", \"2024-01-14\", \"2024-01-16\")),\n price = c(18.49, 19.99, 24.99, 24.99),\n price_rank = c(1, 2, 3, 3),\n memory = c(16e9, 12e9, 10e9, 8e9),\n speed_benchmark = c(0.6, 0.73, 0.82, 0.99)\n)\n\ntt(thumbdrives) |>\n format_tt(j = 1, fn = scales::label_date(\"%e %b\", locale = \"fr\")) |>\n format_tt(j = 2, fn = scales::label_currency()) |>\n format_tt(j = 3, fn = scales::label_ordinal()) |> \n format_tt(j = 4, fn = scales::label_bytes()) |> \n format_tt(j = 5, fn = scales::label_percent()) |>\n format_tt(escape = TRUE)\n\n \n\n \n \n \n tinytable_3kuouuerzo2ch3qj9q6j\n \n \n \n \n \n\n \n \n \n \n \n \n date_lookup\n price\n price_rank\n memory\n speed_benchmark\n \n \n \n \n \n 2024-01-15\n $18.49\n 1st\n 16 GB\n 60%\n \n \n 2024-01-18\n $19.99\n 2nd\n 12 GB\n 73%\n \n \n 2024-01-14\n $24.99\n 3rd\n 10 GB\n 82%\n \n \n 2024-01-16\n $24.99\n 3rd\n 8 GB\n 99%", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -348,7 +348,7 @@ "href": "vignettes/format.html#quarto-data-processing", "title": "Formatting", "section": "", - "text": "Quarto automatically applies some data processing to the content of the tables it renders. By default, tinytable disables this processing, because it can enter in conflict with styling and formatting features of the package.\nTo enable Quarto data processing, we can use the quarto argument of the format_tt() function. This argument allows users to mark certain cells explicitly for processing by Quarto, by wrapping them in a special “span” called “data-qmd”, supported by Quarto:\n\nk <- data.frame(Thing = \"qwerty\", Citation = \"@Lovelace1842\")\n\ntt(k) |> format_tt(quarto = TRUE)\n\n\n \n\n \n \n \n tinytable_ev6fb5hp08hfa2rjvvx6\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nSome users may want to apply Quarto data processing to all tables. This can be done with themes:\n\ntheme_quarto <- function(x) format_tt(x, quarto = TRUE)\noptions(tinytable_tt_theme = theme_quarto)\n\ntt(k)\n\n\n \n\n \n \n \n tinytable_y5xcn8b8g5tkskdyzv73\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nBack to normal:\n\noptions(tinytable_tt_theme = NULL)\n\nAlternatively, users can set a global option to process all tables in Quarto, but they will then have to mark each cell with special content using format_tt(quarto):\n\noptions(tinytable_quarto_disable_processing = FALSE)\n\ntt(x)\n\n\n \n\n \n \n \n tinytable_m001jxqkiz9gtkkiynq0\n \n \n \n \n \n\n \n \n \n\n\n\nmpg\ncyl\ndisp\nhp\ndrat\n\n\n\n\n21.0\n6\n160\n110\n3.90\n\n\n21.0\n6\n160\n110\n3.90\n\n\n22.8\n4\n108\n93\n3.85\n\n\n21.4\n6\n258\n110\n3.08\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nNotice that Quarto is now processing the table, so we lose the default tinytable theme and get the default striped Quarto look.\nBack to normal:\n\noptions(tinytable_quarto_disable_processing = TRUE)", + "text": "Quarto automatically applies some data processing to the content of the tables it renders. By default, tinytable disables this processing, because it can enter in conflict with styling and formatting features of the package.\nTo enable Quarto data processing, we can use the quarto argument of the format_tt() function. This argument allows users to mark certain cells explicitly for processing by Quarto, by wrapping them in a special “span” called “data-qmd”, supported by Quarto:\n\nk <- data.frame(Thing = \"qwerty\", Citation = \"@Lovelace1842\")\n\ntt(k) |> format_tt(quarto = TRUE)\n\n\n \n\n \n \n \n tinytable_1stc1657mskghbxeoctl\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nSome users may want to apply Quarto data processing to all tables. This can be done with themes:\n\ntheme_quarto <- function(x) format_tt(x, quarto = TRUE)\noptions(tinytable_tt_theme = theme_quarto)\n\ntt(k)\n\n\n \n\n \n \n \n tinytable_bsrx6lzsyl6efxf35xx0\n \n \n \n \n \n\n \n \n \n\n\n\nThing\nCitation\n\n\n\n\nqwerty\nLovelace (1842)\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nBack to normal:\n\noptions(tinytable_tt_theme = NULL)\n\nAlternatively, users can set a global option to process all tables in Quarto, but they will then have to mark each cell with special content using format_tt(quarto):\n\noptions(tinytable_quarto_disable_processing = FALSE)\n\ntt(x)\n\n\n \n\n \n \n \n tinytable_zw9dj20cqv2u15qnm5mj\n \n \n \n \n \n\n \n \n \n\n\n\nmpg\ncyl\ndisp\nhp\ndrat\n\n\n\n\n21.0\n6\n160\n110\n3.90\n\n\n21.0\n6\n160\n110\n3.90\n\n\n22.8\n4\n108\n93\n3.85\n\n\n21.4\n6\n258\n110\n3.08\n\n\n\n\n \n\n \n\n \n\n\n\n\n\nNotice that Quarto is now processing the table, so we lose the default tinytable theme and get the default striped Quarto look.\nBack to normal:\n\noptions(tinytable_quarto_disable_processing = TRUE)", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -360,7 +360,7 @@ "href": "vignettes/theme.html", "title": "Themes", "section": "", - "text": "tinytable offers a very flexible theming framwork, which includes a few basic visual looks, as well as other functions to apply collections of transformations to tinytable objects in a repeatable way. These themes can be applied by supplying a string or function to the theme argument in tt(). Alternatively, users can call the theme_tt() function.\nThe main difference between theme_tt() and the other options in package, is that whereas style_tt() and format_tt() aim to be output agnostic, theme_tt() supplies transformations that can be output-specific, and which can have their own sets of distinct arguments. See below for a few examples.\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo begin, let’s explore a few of the basic looks supplied by themes:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_g9aa9oaziqr4lc9rzyap\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_5iyurn2hwxd4ayjppfro\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"grid\")\n\n \n\n \n \n \n tinytable_3qlghwz3gmugwq7twge1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"bootstrap\")\n\n \n\n \n \n \n tinytable_lhjdah4xv5oou6v4y0oi\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nUsers can also define their own themes to apply consistent visual tweaks to tables. For example, this defines a themeing function and sets a global option to apply it to all tables consistently:\n\ntheme_vincent <- function(x, ...) {\n out <- x |> \n style_tt(color = \"teal\") |>\n theme_tt(\"placement\")\n out@caption <- \"Always use the same caption.\"\n return(out)\n}\n\noptions(tinytable_tt_theme = theme_vincent)\n\ntt(mtcars[1:2, 1:2])\n\n \n\n \n \n \n tinytable_lu7ynekelusi8k61r99w\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ntt(mtcars[1:3, 1:3])\n\n \n\n \n \n \n tinytable_bkufwyz4joa9o2cao5cp\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n disp\n \n \n \n \n \n 21 \n 6\n 160\n \n \n 21 \n 6\n 160\n \n \n 22.8\n 4\n 108\n \n \n \n \n\n \n\n \n\n\n\noptions(tinytable_tt_theme = NULL)\n\n\n\n\nThe tabular theme is designed to provide a more “raw” table, without a floating table environment in LaTeX, and without CSS or Javascript in HTML.\n\ntt(x) |> theme_tt(\"tabular\") |> print(\"latex\")\n\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21 & 6 & 160 & 110 & 3.9 \\\\\n21 & 6 & 160 & 110 & 3.9 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{tblr} \n\n\n\n\n\nLaTeX only.\n\n\n\nLaTeX only.\n\n\n\nLaTeX only.", + "text": "tinytable offers a very flexible theming framwork, which includes a few basic visual looks, as well as other functions to apply collections of transformations to tinytable objects in a repeatable way. These themes can be applied by supplying a string or function to the theme argument in tt(). Alternatively, users can call the theme_tt() function.\nThe main difference between theme_tt() and the other options in package, is that whereas style_tt() and format_tt() aim to be output agnostic, theme_tt() supplies transformations that can be output-specific, and which can have their own sets of distinct arguments. See below for a few examples.\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo begin, let’s explore a few of the basic looks supplied by themes:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_6njngyv4awup8qlzwjhm\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_q0by953czfx74hapg1sr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"grid\")\n\n \n\n \n \n \n tinytable_7ub2i207q5gdil1lxfls\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"bootstrap\")\n\n \n\n \n \n \n tinytable_j7xq45j6fwp0002ppvev\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nUsers can also define their own themes to apply consistent visual tweaks to tables. For example, this defines a themeing function and sets a global option to apply it to all tables consistently:\n\ntheme_vincent <- function(x, ...) {\n out <- x |> \n style_tt(color = \"teal\") |>\n theme_tt(\"placement\")\n out@caption <- \"Always use the same caption.\"\n return(out)\n}\n\noptions(tinytable_tt_theme = theme_vincent)\n\ntt(mtcars[1:2, 1:2])\n\n \n\n \n \n \n tinytable_gq0ukqq33p9il9bwppfk\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ntt(mtcars[1:3, 1:3])\n\n \n\n \n \n \n tinytable_neqilerqs8sw2g1qsuzn\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n disp\n \n \n \n \n \n 21 \n 6\n 160\n \n \n 21 \n 6\n 160\n \n \n 22.8\n 4\n 108\n \n \n \n \n\n \n\n \n\n\n\noptions(tinytable_tt_theme = NULL)\n\n\n\n\nThe tabular theme is designed to provide a more “raw” table, without a floating table environment in LaTeX, and without CSS or Javascript in HTML.\n\ntt(x) |> theme_tt(\"tabular\") |> print(\"latex\")\n\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21 & 6 & 160 & 110 & 3.9 \\\\\n21 & 6 & 160 & 110 & 3.9 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{tblr} \n\n\n\n\n\nLaTeX only.\n\n\n\nLaTeX only.\n\n\n\nLaTeX only.", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -372,7 +372,7 @@ "href": "vignettes/theme.html#visual-themes", "title": "Themes", "section": "", - "text": "To begin, let’s explore a few of the basic looks supplied by themes:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_g9aa9oaziqr4lc9rzyap\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_5iyurn2hwxd4ayjppfro\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"grid\")\n\n \n\n \n \n \n tinytable_3qlghwz3gmugwq7twge1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"bootstrap\")\n\n \n\n \n \n \n tinytable_lhjdah4xv5oou6v4y0oi\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "To begin, let’s explore a few of the basic looks supplied by themes:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_6njngyv4awup8qlzwjhm\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_q0by953czfx74hapg1sr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"grid\")\n\n \n\n \n \n \n tinytable_7ub2i207q5gdil1lxfls\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, theme = \"bootstrap\")\n\n \n\n \n \n \n tinytable_j7xq45j6fwp0002ppvev\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -384,7 +384,7 @@ "href": "vignettes/theme.html#custom-themes", "title": "Themes", "section": "", - "text": "Users can also define their own themes to apply consistent visual tweaks to tables. For example, this defines a themeing function and sets a global option to apply it to all tables consistently:\n\ntheme_vincent <- function(x, ...) {\n out <- x |> \n style_tt(color = \"teal\") |>\n theme_tt(\"placement\")\n out@caption <- \"Always use the same caption.\"\n return(out)\n}\n\noptions(tinytable_tt_theme = theme_vincent)\n\ntt(mtcars[1:2, 1:2])\n\n \n\n \n \n \n tinytable_lu7ynekelusi8k61r99w\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ntt(mtcars[1:3, 1:3])\n\n \n\n \n \n \n tinytable_bkufwyz4joa9o2cao5cp\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n disp\n \n \n \n \n \n 21 \n 6\n 160\n \n \n 21 \n 6\n 160\n \n \n 22.8\n 4\n 108\n \n \n \n \n\n \n\n \n\n\n\noptions(tinytable_tt_theme = NULL)", + "text": "Users can also define their own themes to apply consistent visual tweaks to tables. For example, this defines a themeing function and sets a global option to apply it to all tables consistently:\n\ntheme_vincent <- function(x, ...) {\n out <- x |> \n style_tt(color = \"teal\") |>\n theme_tt(\"placement\")\n out@caption <- \"Always use the same caption.\"\n return(out)\n}\n\noptions(tinytable_tt_theme = theme_vincent)\n\ntt(mtcars[1:2, 1:2])\n\n \n\n \n \n \n tinytable_gq0ukqq33p9il9bwppfk\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ntt(mtcars[1:3, 1:3])\n\n \n\n \n \n \n tinytable_neqilerqs8sw2g1qsuzn\n \n \n \n \n \n\n \n \n \n \n Always use the same caption.\n \n mpg\n cyl\n disp\n \n \n \n \n \n 21 \n 6\n 160\n \n \n 21 \n 6\n 160\n \n \n 22.8\n 4\n 108\n \n \n \n \n\n \n\n \n\n\n\noptions(tinytable_tt_theme = NULL)", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -486,7 +486,7 @@ "href": "NEWS.html", "title": "News", "section": "", - "text": "Breaking change:\n\nThe width argument is moved from style_tt() to tt().\n\ntt():\n\nwidth argument now accepts a vector of numeric values to control the width of each column, as a proportion of the total linewidth.\n\nformat_tt():\n\nNew quarto argument enables Quarto data processing for the whole table and marks specific cells as containing Quarto content. This is especially useful to include @Citation1981 in a table. Thanks to @andrewheiss for issue #215 and @giabaio for further discussion and debugging.\nNew replace argument which accepts a single logical, a single string, or a named list to specify multiple replacements.\nreplace=TRUE by default replaces NA by an empty string. FALSE prints “NA” as string.\nreplace_na is deprecated in favor of replace. Backward compatibility is maintained and a warning is issued.\nAll arguments can now be set using global options.\n\ntheme_tt():\n\n“void” is now supported for Typst tables. Thanks to @marcboschmatas for PR #223.\n\nstyle_tt():\n\nNo longer keep many versions of the same data frame, which could increase memory use. Thanks to @MarcoPortmann for the report.\n\nsave_tt():\n\nDo not change working directory when saving to file raises an error. Thanks to @etiennebacher for report #225.\n\nTypst:\n\nBetter compatibility with Quarto captions. Recommended strategy is to not use the caption argument, and rather to define both the label and tbl-cap chunk options in Quarto. This is a breaking change, as Typst tables are no longer enclosed in a #figure environment in Quarto documents when both tbl-cap and label chunk options are defined.\n\nMisc:\n\nTable objects can be modified and printed several times —with styling— in a single HTML document like a ReavealJS slideshow. Thanks to @kazuyanagimoto for report #759.\nGlobal option to enable Quarto data processing: options(tinytable_quarto_disable_processing = FALSE). Thanks to @andrewheiss for issue #215.\n\nBug fixes:\n\nData frames without column headers could be displayed as “c(1,2,3,3)”. Bug in format_tt(). Issue #230.\nsave_tt() can now save to PDF when the table includes a caption. Thanks to @etiennebacher for report #224.\ngroup_tt(i) inserted an extra latex column, which made horizontal lines stop to early. Thanks to @andrewheiss for report #235.\n\n\n\n\n\nRStudio displays table in HTML viewer by default when the rstudioapi package is available.\ncolnames and colnames<- are now exported functions.\ntt() supports data.frame-like objects which also inherit from other classes, ex: marginaleffects::slopes()\nBug: options(tinytable_tt_print) is respected in print() without argument.\n\n\n\n\nNew features:\n\nrbind() and rbind2() can be used to stack tinytable objects. rbind2() is more flexible than rbind(). See ?tinytable::rbind2\nNew output format in print(): “dataframe”\nRename table headers: colnames(tab) <- c(\"a\", \"b\", \"c\")\ntheme_tt(\"resize\") gets a direction argument with “up”, “down”, “both” options. Thanks to @MarcoPortmann for feature request #207\n\nMinor:\n\nInformative error message when no default browser is selected via global options.\nFix CRAN errors on Mac old releases.\n\nBugs:\n\ntheme_tt() resize issue with talltblr environment and notes in LaTeX. Thanks to @MarcoPortmann for reporting issue #206\n\n\n\n\nNew function theme_tt():\n\nFunction to apply collections of transformations to a tinytable.\nVisual themes:\n\ngrid, void, striped, bootstrap, default\n\nresize: Insert a LaTeX table in a resizebox environment to ensure a table fits the page, or to scale it to a fraction of \\linewidth\nplacement: Determine where a LaTeX table float is positioned. Ex: [H], [htbp]\nmultipage: Split long LaTeX tables across multiple pages with (optional) repeated headers/footers. Uses the longtblr environment from tabularray.\n\nformat_tt():\n\nNew i argument to format subsets of rows.\nNew fn argument which accepts an arbitrary function to format table content.\nnum_fmt=\"significant_cell\" rounds significant digits on a cell-by-cell basis rather than for full columns (as is default in base R format()).\nNumeric formatting options can be set via global options, defined in the function signature.\nnum_mark_big and num_mark_dec require an explicit digits. We now raise an informative error.\nescape = TRUE now escapes captions, notes, and spanning cells created by group_tt() when i and j are both NULL. To avoid escaping group labels, users can specify i and/or j explicitly.\n\nTypst format:\n\nSupport for row headers with group_tt(i)\nSupports images and inline plots with plot_tt(). Thanks to @aghaynes for contribution #155.\n“kind: tinytable” parameter is now added to all figures enclosing a tinytable. This allows users to apply targeted show rules. For example, in a table of contents: outline(target: figure.where(kind: \"tinytable\"))\n\nMisc:\n\nstyle_tt() gains a finalize argument. This accepts functions to be applied to the table object at the very end of the building process, to programmatically change its content. For example, this can be used with regular expressions to modify the text version of the table hosted in tab@table_string, or the function could programmatically modify the caption in tab@caption.\nstyle_tt(): LaTeX format supports decimal alignement with align=\"d\". The width of columns is determined by the maximum number of digits to the left and to the right in all cells specified by i, j.\nSupport RevealJS slides in Quarto documents.\nImproved support for tibble. ANSI characters (ex: fancy pillar formatting) are stripped automatically or converted to HTML when the fansi package is installed. fansi is a dependency of tibble, so it should often be installed.\nNew tinytable_tt_digits global option can set the default number of digits in the tt() function.\nRefactor: tinytable objects are now S4 class objects, with slots to hold data about the content and structure.\nas.character() now works on tinytable objects, returning a string in the output format specified by the @output slot of the tinytable object (markdown by default).\nLaTeX code in captions no longer requires double escaping, allowing: tt(x, caption = \"Blah blah \\\\label{tab:blah})\n\nBreaking changes:\n\nIn some cases, format_tt() could be use sequentially to apply two formats to the same cell. Now, multiple calls to format_tt() can still be make chained with pipes, but they must apply to different cells with i, j, otherwise only the last change is respected. One exception is the escape argument which can be applied to pre-formatted cells.\ntinytable objects no longer have a meta_tinytable attribute. Use S4 slots instead.\nplacement argument in tt() is removed in favor of theme_tt(\"placement\").\n\nBugs:\n\nformat_tt() did not work on factor vector.\n\n\n\n\n\nformat_tt() escapes <> tags in Typst.\nBug introduced in 0.0.4 prevented group_tt(i) in HTML.\n\n\n\n\nNew:\n\nj argument in style_tt() and format_tt() now accepts a string vector to match columns. Issue #122\nLine plots: plot_tt(fun = \"line\")\nformat_tt(j=NULL, escape=TRUE) now escapes column headers in addition to all cells.\nformat_tt() gains a replace_na argument to replace missing values.\nstyle_tt(): rowspan and colspan arguments are now supported in all formats except Typst. In markdown and Word, we get “pseudo-spans” with empty cells around the main cell, instead of true merged cells.\nstyle_tt(): alignv argument is now supported for LaTeX and HTML\n\nBugfix:\n\nMarkdown group columns when labels are wider than columns. Thanks to @etiennebacher for report #127.\nMarkdown group rows broke indexing when using style_tt(). Thanks to @strengejacke for report #133.\n\n\n\n\nNew:\n\nTypst tables are now supported using the tablex extension:\n\nhttps://typst.app/\nhttps://github.com/PgBiel/typst-tablex\n\nescape argument in format_tt() escapes or substitutes special characters in LaTeX or HTML output to prevent compilation and rendering errors.\nnotes argument in tt() can insert superscript markers inside cells to refer to notes at the bottom of the page.\n\ntt(x, notes = list(\"*\" = list(i = 0:1, j = 2, text = \"Hello world)))\n\nnotes agument in tt() now works wth Markdown and Word, but must be a single string.\ngroup_tt() can be called multiple times to create mult-row headers.\n\n\n\n\nImprovements:\n\nRules and cell borders: line, line_width, and line_color arguments.\nEnhanced knitr output detection.\nNew themes.\nCaption argument support for Markdown tables.\nDefensive programming enhancements.\nplot_tt() regular expression column selection.\nHeader/footer are no longer indented by group_tt(i).\n\nBug fixes:\n\nInline plots visibility in RStudio viewer pane.\nBug in group_tt(i) for markdown and docx output.\nResolved style_tt resetting issue.\nBug fix for column alignment in markdown affecting docx output.\n\nDocumentation:\n\nImproved vignette on the package website.\nVarious documentation updates.\nMath in $$ is the new recommendation.\n\n\n\n\nInitial package release. Yay!", + "text": "Breaking change:\n\nThe width argument is moved from style_tt() to tt().\n\ntt():\n\nwidth argument now accepts a vector of numeric values to control the width of each column, as a proportion of the total linewidth.\n\nformat_tt():\n\nNew quarto argument enables Quarto data processing for the whole table and marks specific cells as containing Quarto content. This is especially useful to include @Citation1981 in a table. Thanks to @andrewheiss for issue #215 and @giabaio for further discussion and debugging.\nNew replace argument which accepts a single logical, a single string, or a named list to specify multiple replacements.\nreplace=TRUE by default replaces NA by an empty string. FALSE prints “NA” as string.\nreplace_na is deprecated in favor of replace. Backward compatibility is maintained and a warning is issued.\nAll arguments can now be set using global options.\n\ntheme_tt():\n\n“void” is now supported for Typst tables. Thanks to @marcboschmatas for PR #223.\n\nstyle_tt():\n\nNo longer keep many versions of the same data frame, which could increase memory use. Thanks to @MarcoPortmann for the report.\n\nsave_tt():\n\nDo not change working directory when saving to file raises an error. Thanks to @etiennebacher for report #225.\n\nTypst:\n\nBetter compatibility with Quarto captions. Recommended strategy is to not use the caption argument, and rather to define both the label and tbl-cap chunk options in Quarto. This is a breaking change, as Typst tables are no longer enclosed in a #figure environment in Quarto documents when both tbl-cap and label chunk options are defined.\n\nMisc:\n\nSupport beamer_presentations, but see: https://github.com/vincentarelbundock/tinytable/issues/244\nTable objects can be modified and printed several times —with styling— in a single HTML document like a ReavealJS slideshow. Thanks to @kazuyanagimoto for report #759.\nGlobal option to enable Quarto data processing: options(tinytable_quarto_disable_processing = FALSE). Thanks to @andrewheiss for issue #215.\n\nBug fixes:\n\nData frames without column headers could be displayed as “c(1,2,3,3)”. Bug in format_tt(). Issue #230.\nsave_tt() can now save to PDF when the table includes a caption. Thanks to @etiennebacher for report #224.\ngroup_tt(i) inserted an extra latex column, which made horizontal lines stop to early. Thanks to @andrewheiss for report #235.\n\n\n\n\n\nRStudio displays table in HTML viewer by default when the rstudioapi package is available.\ncolnames and colnames<- are now exported functions.\ntt() supports data.frame-like objects which also inherit from other classes, ex: marginaleffects::slopes()\nBug: options(tinytable_tt_print) is respected in print() without argument.\n\n\n\n\nNew features:\n\nrbind() and rbind2() can be used to stack tinytable objects. rbind2() is more flexible than rbind(). See ?tinytable::rbind2\nNew output format in print(): “dataframe”\nRename table headers: colnames(tab) <- c(\"a\", \"b\", \"c\")\ntheme_tt(\"resize\") gets a direction argument with “up”, “down”, “both” options. Thanks to @MarcoPortmann for feature request #207\n\nMinor:\n\nInformative error message when no default browser is selected via global options.\nFix CRAN errors on Mac old releases.\n\nBugs:\n\ntheme_tt() resize issue with talltblr environment and notes in LaTeX. Thanks to @MarcoPortmann for reporting issue #206\n\n\n\n\nNew function theme_tt():\n\nFunction to apply collections of transformations to a tinytable.\nVisual themes:\n\ngrid, void, striped, bootstrap, default\n\nresize: Insert a LaTeX table in a resizebox environment to ensure a table fits the page, or to scale it to a fraction of \\linewidth\nplacement: Determine where a LaTeX table float is positioned. Ex: [H], [htbp]\nmultipage: Split long LaTeX tables across multiple pages with (optional) repeated headers/footers. Uses the longtblr environment from tabularray.\n\nformat_tt():\n\nNew i argument to format subsets of rows.\nNew fn argument which accepts an arbitrary function to format table content.\nnum_fmt=\"significant_cell\" rounds significant digits on a cell-by-cell basis rather than for full columns (as is default in base R format()).\nNumeric formatting options can be set via global options, defined in the function signature.\nnum_mark_big and num_mark_dec require an explicit digits. We now raise an informative error.\nescape = TRUE now escapes captions, notes, and spanning cells created by group_tt() when i and j are both NULL. To avoid escaping group labels, users can specify i and/or j explicitly.\n\nTypst format:\n\nSupport for row headers with group_tt(i)\nSupports images and inline plots with plot_tt(). Thanks to @aghaynes for contribution #155.\n“kind: tinytable” parameter is now added to all figures enclosing a tinytable. This allows users to apply targeted show rules. For example, in a table of contents: outline(target: figure.where(kind: \"tinytable\"))\n\nMisc:\n\nstyle_tt() gains a finalize argument. This accepts functions to be applied to the table object at the very end of the building process, to programmatically change its content. For example, this can be used with regular expressions to modify the text version of the table hosted in tab@table_string, or the function could programmatically modify the caption in tab@caption.\nstyle_tt(): LaTeX format supports decimal alignement with align=\"d\". The width of columns is determined by the maximum number of digits to the left and to the right in all cells specified by i, j.\nSupport RevealJS slides in Quarto documents.\nImproved support for tibble. ANSI characters (ex: fancy pillar formatting) are stripped automatically or converted to HTML when the fansi package is installed. fansi is a dependency of tibble, so it should often be installed.\nNew tinytable_tt_digits global option can set the default number of digits in the tt() function.\nRefactor: tinytable objects are now S4 class objects, with slots to hold data about the content and structure.\nas.character() now works on tinytable objects, returning a string in the output format specified by the @output slot of the tinytable object (markdown by default).\nLaTeX code in captions no longer requires double escaping, allowing: tt(x, caption = \"Blah blah \\\\label{tab:blah})\n\nBreaking changes:\n\nIn some cases, format_tt() could be use sequentially to apply two formats to the same cell. Now, multiple calls to format_tt() can still be make chained with pipes, but they must apply to different cells with i, j, otherwise only the last change is respected. One exception is the escape argument which can be applied to pre-formatted cells.\ntinytable objects no longer have a meta_tinytable attribute. Use S4 slots instead.\nplacement argument in tt() is removed in favor of theme_tt(\"placement\").\n\nBugs:\n\nformat_tt() did not work on factor vector.\n\n\n\n\n\nformat_tt() escapes <> tags in Typst.\nBug introduced in 0.0.4 prevented group_tt(i) in HTML.\n\n\n\n\nNew:\n\nj argument in style_tt() and format_tt() now accepts a string vector to match columns. Issue #122\nLine plots: plot_tt(fun = \"line\")\nformat_tt(j=NULL, escape=TRUE) now escapes column headers in addition to all cells.\nformat_tt() gains a replace_na argument to replace missing values.\nstyle_tt(): rowspan and colspan arguments are now supported in all formats except Typst. In markdown and Word, we get “pseudo-spans” with empty cells around the main cell, instead of true merged cells.\nstyle_tt(): alignv argument is now supported for LaTeX and HTML\n\nBugfix:\n\nMarkdown group columns when labels are wider than columns. Thanks to @etiennebacher for report #127.\nMarkdown group rows broke indexing when using style_tt(). Thanks to @strengejacke for report #133.\n\n\n\n\nNew:\n\nTypst tables are now supported using the tablex extension:\n\nhttps://typst.app/\nhttps://github.com/PgBiel/typst-tablex\n\nescape argument in format_tt() escapes or substitutes special characters in LaTeX or HTML output to prevent compilation and rendering errors.\nnotes argument in tt() can insert superscript markers inside cells to refer to notes at the bottom of the page.\n\ntt(x, notes = list(\"*\" = list(i = 0:1, j = 2, text = \"Hello world)))\n\nnotes agument in tt() now works wth Markdown and Word, but must be a single string.\ngroup_tt() can be called multiple times to create mult-row headers.\n\n\n\n\nImprovements:\n\nRules and cell borders: line, line_width, and line_color arguments.\nEnhanced knitr output detection.\nNew themes.\nCaption argument support for Markdown tables.\nDefensive programming enhancements.\nplot_tt() regular expression column selection.\nHeader/footer are no longer indented by group_tt(i).\n\nBug fixes:\n\nInline plots visibility in RStudio viewer pane.\nBug in group_tt(i) for markdown and docx output.\nResolved style_tt resetting issue.\nBug fix for column alignment in markdown affecting docx output.\n\nDocumentation:\n\nImproved vignette on the package website.\nVarious documentation updates.\nMath in $$ is the new recommendation.\n\n\n\n\nInitial package release. Yay!", "crumbs": [ "Tutorial (PDF)", "News" @@ -497,7 +497,7 @@ "href": "NEWS.html#development", "title": "News", "section": "", - "text": "Breaking change:\n\nThe width argument is moved from style_tt() to tt().\n\ntt():\n\nwidth argument now accepts a vector of numeric values to control the width of each column, as a proportion of the total linewidth.\n\nformat_tt():\n\nNew quarto argument enables Quarto data processing for the whole table and marks specific cells as containing Quarto content. This is especially useful to include @Citation1981 in a table. Thanks to @andrewheiss for issue #215 and @giabaio for further discussion and debugging.\nNew replace argument which accepts a single logical, a single string, or a named list to specify multiple replacements.\nreplace=TRUE by default replaces NA by an empty string. FALSE prints “NA” as string.\nreplace_na is deprecated in favor of replace. Backward compatibility is maintained and a warning is issued.\nAll arguments can now be set using global options.\n\ntheme_tt():\n\n“void” is now supported for Typst tables. Thanks to @marcboschmatas for PR #223.\n\nstyle_tt():\n\nNo longer keep many versions of the same data frame, which could increase memory use. Thanks to @MarcoPortmann for the report.\n\nsave_tt():\n\nDo not change working directory when saving to file raises an error. Thanks to @etiennebacher for report #225.\n\nTypst:\n\nBetter compatibility with Quarto captions. Recommended strategy is to not use the caption argument, and rather to define both the label and tbl-cap chunk options in Quarto. This is a breaking change, as Typst tables are no longer enclosed in a #figure environment in Quarto documents when both tbl-cap and label chunk options are defined.\n\nMisc:\n\nTable objects can be modified and printed several times —with styling— in a single HTML document like a ReavealJS slideshow. Thanks to @kazuyanagimoto for report #759.\nGlobal option to enable Quarto data processing: options(tinytable_quarto_disable_processing = FALSE). Thanks to @andrewheiss for issue #215.\n\nBug fixes:\n\nData frames without column headers could be displayed as “c(1,2,3,3)”. Bug in format_tt(). Issue #230.\nsave_tt() can now save to PDF when the table includes a caption. Thanks to @etiennebacher for report #224.\ngroup_tt(i) inserted an extra latex column, which made horizontal lines stop to early. Thanks to @andrewheiss for report #235.", + "text": "Breaking change:\n\nThe width argument is moved from style_tt() to tt().\n\ntt():\n\nwidth argument now accepts a vector of numeric values to control the width of each column, as a proportion of the total linewidth.\n\nformat_tt():\n\nNew quarto argument enables Quarto data processing for the whole table and marks specific cells as containing Quarto content. This is especially useful to include @Citation1981 in a table. Thanks to @andrewheiss for issue #215 and @giabaio for further discussion and debugging.\nNew replace argument which accepts a single logical, a single string, or a named list to specify multiple replacements.\nreplace=TRUE by default replaces NA by an empty string. FALSE prints “NA” as string.\nreplace_na is deprecated in favor of replace. Backward compatibility is maintained and a warning is issued.\nAll arguments can now be set using global options.\n\ntheme_tt():\n\n“void” is now supported for Typst tables. Thanks to @marcboschmatas for PR #223.\n\nstyle_tt():\n\nNo longer keep many versions of the same data frame, which could increase memory use. Thanks to @MarcoPortmann for the report.\n\nsave_tt():\n\nDo not change working directory when saving to file raises an error. Thanks to @etiennebacher for report #225.\n\nTypst:\n\nBetter compatibility with Quarto captions. Recommended strategy is to not use the caption argument, and rather to define both the label and tbl-cap chunk options in Quarto. This is a breaking change, as Typst tables are no longer enclosed in a #figure environment in Quarto documents when both tbl-cap and label chunk options are defined.\n\nMisc:\n\nSupport beamer_presentations, but see: https://github.com/vincentarelbundock/tinytable/issues/244\nTable objects can be modified and printed several times —with styling— in a single HTML document like a ReavealJS slideshow. Thanks to @kazuyanagimoto for report #759.\nGlobal option to enable Quarto data processing: options(tinytable_quarto_disable_processing = FALSE). Thanks to @andrewheiss for issue #215.\n\nBug fixes:\n\nData frames without column headers could be displayed as “c(1,2,3,3)”. Bug in format_tt(). Issue #230.\nsave_tt() can now save to PDF when the table includes a caption. Thanks to @etiennebacher for report #224.\ngroup_tt(i) inserted an extra latex column, which made horizontal lines stop to early. Thanks to @andrewheiss for report #235.", "crumbs": [ "Tutorial (PDF)", "News" @@ -632,7 +632,7 @@ "href": "vignettes/tinytable.html", "title": "Tiny Tables", "section": "", - "text": "tinytable is a small but powerful R package to draw HTML, LaTeX, Word, PDF, Markdown, and Typst tables. The interface is minimalist, but it gives users direct and convenient access to powerful frameworks to create endlessly customizable tables.\nInstall the latest version from R-Universe or CRAN:\n\ninstall.packages(\"tinytable\",\n repos = c(\"https://vincentarelbundock.r-universe.dev\", \"https://cran.r-project.org\"))\n\nThis tutorial introduces the main functions of the package. It is also available as a single PDF document.\nLoad the library and set some global options:\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\n\nDraw a first table:\n\nx <- mtcars[1:4, 1:5]\ntt(x)\n\n \n\n \n \n \n tinytable_m3117y6rldfm847w57o4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\nThe width arguments indicating what proportion of the line width the table should cover. This argument accepts a number between 0 and 1 to control the whole table width, or a vector of numeric values between 0 and 1, representing each column.\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_wf42pnnubfgmmb4u4p4h\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, width = 1)\n\n \n\n \n \n \n tinytable_kz6axqhxh8kxwezyzecc\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can control individual columns by supplying a vector. In that case, the sum of width elements determines the full table width. For example, this table takes 70% of available width, with the first column 3 times as large as the other ones.\n\ntt(x, width = c(.3, .1, .1, .1, .1))\n\n \n\n \n \n \n tinytable_fk4o5lx9iai5hkawjg93\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen the sum of the width vector exceeds 1, it is automatically normalized to full-width. This is convenient when we only want to specify column width in relative terms:\n\ntt(x, width = c(3, 2, 1, 1, 1))\n\n \n\n \n \n \n tinytable_s5puwk4q7nwbnr7k8avb\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen specifying a table width, the text is automatically wrapped to appropriate size:\n\nlorem <- data.frame(\n Lorem = \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\",\n Ipsum = \" Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\"\n)\n\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_xoyf73mi0785zdcf0i3r\n \n \n \n \n \n\n \n \n \n \n \n \n Lorem\n Ipsum\n \n \n \n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe notes argument accepts single strings or named lists of strings:\n\nn <- \"Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\"\n\ntt(lorem, notes = n, width = 1)\n\n \n\n \n \n \n tinytable_ztpvefvbeipyp4sdqpc2\n \n \n \n \n \n\n \n \n A full-width table with wrapped text in cells and a footnote.\n \n \n \n Lorem\n Ipsum\n \n \n Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\nWhen notes is a named list, the names are used as identifiers and displayed as superscripts:\n\ntt(x, notes = list(a = \"Blah.\", b = \"Blah blah.\"))\n\n \n\n \n \n \n tinytable_qb4qx3hp1rg0d9vw9gxx\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also add markers in individual cells by providing coordinates:\n\ntt(x, notes = list(\n a = list(i = 0:1, j = 1, text = \"Blah.\"),\n b = \"Blah blah.\"\n )\n)\n\n \n\n \n \n \n tinytable_6fyfut21ftmpev2mesp4\n \n \n \n \n \n\n \n \n \n \n \n \n mpga\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 a\n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nIn Quarto, one should always specify captions cross-references using chunk options, and should not use the caption argument. This is because Quarto automatically post-processes tables, and may introduce conflict with the captions inserted by tinytable. For example:\n@tbl-blah shows that...\n\n```{r}\n#| label: tbl-blah\n#| tbl-cap: \"Blah blah blah\"\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n```\nAnd here is the rendered version of the code chunk above:\nTable 1 shows that…\n\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_055r5to5c26453w2i9zl\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21 \n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93 \n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOne exception to the injunction above is when rendering a Quarto document to LaTeX using theme_tt(\"multipage\")\". In that case, one must avoid using the Quarto chunk option, because these options trigger Quarto post-processing that will conflict with the longtblr environment used to split long tables across multiple pages.\nThe alternative is to use to refer to tables using standard LaTeX syntax: \\ref{tbl-ex-multipage}. Then, use the caption argument in tt() to specify both the label and the caption:\n\ntt(iris, caption = \"Example table.\\\\label{tbl-ex-multipage}\") |>\n theme_tt(\"multipage\")\n\nFor standalone tables in any format (i.e., outside Quarto), you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")\n\n\n\n\nTo insert LaTeX-style mathematical expressions in a tinytable, we enclose the expression in dollar signs: $...$. The expression will then rendered as a mathematical expression by MathJax (for HTML), LaTeX, or Pandoc. Do not forget to double escape any backslashes.\n\ndat <- data.frame(Math = c(\n \"$x^2 + y^2 = z^2$\",\n \"$\\\\frac{1}{2}$\"\n))\ntt(dat) |> style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_9w9uc2kb5v43oag5fd2u\n \n \n \n \n \n\n \n \n \n \n \n \n Math\n \n \n \n \n \n $x^2 + y^2 = z^2$\n \n \n $\\frac{1}{2}$ \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nManual line breaks work sligthly different in LaTeX (PDF) or HTML. This table shows the two strategies. For HTML, we insert a <br> tag. For LaTeX, we wrap the string in curly braces {}, and then insert two (escaped) backslashes: \\\\\\\\\n\nd <- data.frame(\n \"{Sed ut \\\\\\\\ perspiciatis unde}\",\n \"dicta sunt<br> explicabo. Nemo\"\n) |> setNames(c(\"LaTeX line break\", \"HTML line break\"))\ntt(d, width = 1)\n\n \n\n \n \n \n tinytable_j3jztxkf1kkbjjlt9hpg\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX line break\n HTML line break\n \n \n \n \n \n {Sed ut \\\\ perspiciatis unde}\n dicta sunt explicabo. Nemo\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\ntinytable can produce tables in HTML, Word, Markdown, LaTeX, Typst, PDF, or PNG format. An appropriate output format for printing is automatically selected based on (1) whether the function is called interactively, (2) is called within RStudio, and (3) the output format of the Rmarkdown or Quarto document, if applicable. Alternatively, users can specify the print format in print() or by setting a global option:\n\ntt(x) |> print(\"markdown\")\ntt(x) |> print(\"html\")\ntt(x) |> print(\"latex\")\n\noptions(tinytable_print_output = \"markdown\")\n\nWith the save_tt() function, users can also save tables directly to PNG (images), PDF or Word documents, and to any of the basic formats. All we need to do is supply a valid file name with the appropriate extension (ex: .png, .html, .pdf, etc.):\ntt(x) |> save_tt(\"path/to/file.png\")\ntt(x) |> save_tt(\"path/to/file.pdf\")\ntt(x) |> save_tt(\"path/to/file.docx\")\ntt(x) |> save_tt(\"path/to/file.html\")\ntt(x) |> save_tt(\"path/to/file.tex\")\ntt(x) |> save_tt(\"path/to/file.md\")\nsave_tt() can also return a string with the table in it, for further processing in R. In the first case, the table is printed to console with cat(). In the second case, it returns as a single string as an R object.\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5)) |>\n print(\"markdown\")\n\n+------+-----+------+-----+------+\n| | Foo | Bar |\n+------+-----+------+-----+------+\n| mpg | cyl | disp | hp | drat |\n+======+=====+======+=====+======+\n| 21 | 6 | 160 | 110 | 3.9 |\n+------+-----+------+-----+------+\n| 21 | 6 | 160 | 110 | 3.9 |\n+------+-----+------+-----+------+\n| Hello |\n+------+-----+------+-----+------+\n| 22.8 | 4 | 108 | 93 | 3.85 |\n+------+-----+------+-----+------+\n| 21.4 | 6 | 258 | 110 | 3.08 |\n+------+-----+------+-----+------+\n| 18.7 | 8 | 360 | 175 | 3.15 |\n+------+-----+------+-----+------+\n| 18.1 | 6 | 225 | 105 | 2.76 |\n+------+-----+------+-----+------+\n| 14.3 | 8 | 360 | 245 | 3.21 |\n+------+-----+------+-----+------+\n| World |\n+------+-----+------+-----+------+\n| 24.4 | 4 | 147 | 62 | 3.69 |\n+------+-----+------+-----+------+\n| 22.8 | 4 | 141 | 95 | 3.92 |\n+------+-----+------+-----+------+\n| 19.2 | 6 | 168 | 123 | 3.92 |\n+------+-----+------+-----+------+ \n\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5)) |>\n save_tt(\"markdown\")\n\n[1] \"+------+-----+------+-----+------+\\n| | Foo | Bar |\\n+------+-----+------+-----+------+\\n| mpg | cyl | disp | hp | drat |\\n+======+=====+======+=====+======+\\n| 21 | 6 | 160 | 110 | 3.9 |\\n+------+-----+------+-----+------+\\n| 21 | 6 | 160 | 110 | 3.9 |\\n+------+-----+------+-----+------+\\n| Hello |\\n+------+-----+------+-----+------+\\n| 22.8 | 4 | 108 | 93 | 3.85 |\\n+------+-----+------+-----+------+\\n| 21.4 | 6 | 258 | 110 | 3.08 |\\n+------+-----+------+-----+------+\\n| 18.7 | 8 | 360 | 175 | 3.15 |\\n+------+-----+------+-----+------+\\n| 18.1 | 6 | 225 | 105 | 2.76 |\\n+------+-----+------+-----+------+\\n| 14.3 | 8 | 360 | 245 | 3.21 |\\n+------+-----+------+-----+------+\\n| World |\\n+------+-----+------+-----+------+\\n| 24.4 | 4 | 147 | 62 | 3.69 |\\n+------+-----+------+-----+------+\\n| 22.8 | 4 | 141 | 95 | 3.92 |\\n+------+-----+------+-----+------+\\n| 19.2 | 6 | 168 | 123 | 3.92 |\\n+------+-----+------+-----+------+\"\n\n\n\n\n\nTables can be explored, modified, and combined using many of the usual base R functions:\n\na <- tt(mtcars[1:2, 1:2])\na\n\n \n\n \n \n \n tinytable_kyl9oty8yu72pyedx7kw\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ndim(a)\n\n[1] 2 2\n\nncol(a)\n\n[1] 2\n\nnrow(a)\n\n[1] 2\n\ncolnames(a)\n\n[1] \"mpg\" \"cyl\"\n\n\nRename columns:\n\ncolnames(a) <- c(\"a\", \"b\")\na\n\n \n\n \n \n \n tinytable_otlukq6iuqveldxlci34\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\n\nTables can be combined with the usual rbind() function:\n\na <- tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\nb <- tt(mtcars[4:5, 8:10]) \n\nrbind(a, b)\n\n \n\n \n \n \n tinytable_au4f7f70jncfxa3zgv0b\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1 \n 0 \n 3 \n \n \n \n \n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(a, b) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_vk0nuew5t50s7syj3i35\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nThe rbind2() S4 method is slightly more flexible than rbind(), as it supports arguments headers and use.names.\nOmit y header:\n\nrbind2(a, b, headers = FALSE)\n\n \n\n \n \n \n tinytable_mowlpehl09d5kyedouom\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nBind tables by position rather than column names:\n\nrbind2(a, b, use_names = FALSE)\n\n \n\n \n \n \n tinytable_p8y7ldghg19lbsif8fo3\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21 \n 6 \n \n \n \n 21 \n 6 \n \n \n \n 22.8\n 4 \n \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", + "text": "tinytable is a small but powerful R package to draw HTML, LaTeX, Word, PDF, Markdown, and Typst tables. The interface is minimalist, but it gives users direct and convenient access to powerful frameworks to create endlessly customizable tables.\nInstall the latest version from R-Universe or CRAN:\n\ninstall.packages(\"tinytable\",\n repos = c(\"https://vincentarelbundock.r-universe.dev\", \"https://cran.r-project.org\"))\n\nThis tutorial introduces the main functions of the package. It is also available as a single PDF document.\nLoad the library and set some global options:\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\n\nDraw a first table:\n\nx <- mtcars[1:4, 1:5]\ntt(x)\n\n \n\n \n \n \n tinytable_f4y1syb95vqszir9axcg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\nThe width arguments indicating what proportion of the line width the table should cover. This argument accepts a number between 0 and 1 to control the whole table width, or a vector of numeric values between 0 and 1, representing each column.\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_1zq0m1pws5ko61e6fx30\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, width = 1)\n\n \n\n \n \n \n tinytable_b7vn14rd7675honi0g5l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can control individual columns by supplying a vector. In that case, the sum of width elements determines the full table width. For example, this table takes 70% of available width, with the first column 3 times as large as the other ones.\n\ntt(x, width = c(.3, .1, .1, .1, .1))\n\n \n\n \n \n \n tinytable_lvk8gxcluzb6bzt6ihha\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen the sum of the width vector exceeds 1, it is automatically normalized to full-width. This is convenient when we only want to specify column width in relative terms:\n\ntt(x, width = c(3, 2, 1, 1, 1))\n\n \n\n \n \n \n tinytable_eip64npgge4wm0r4czhp\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen specifying a table width, the text is automatically wrapped to appropriate size:\n\nlorem <- data.frame(\n Lorem = \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\",\n Ipsum = \" Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\"\n)\n\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_kt9yi7dmizkkh2mvkwry\n \n \n \n \n \n\n \n \n \n \n \n \n Lorem\n Ipsum\n \n \n \n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe notes argument accepts single strings or named lists of strings:\n\nn <- \"Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\"\n\ntt(lorem, notes = n, width = 1)\n\n \n\n \n \n \n tinytable_l6sw7dyot3eqcb69k803\n \n \n \n \n \n\n \n \n A full-width table with wrapped text in cells and a footnote.\n \n \n \n Lorem\n Ipsum\n \n \n Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\nWhen notes is a named list, the names are used as identifiers and displayed as superscripts:\n\ntt(x, notes = list(a = \"Blah.\", b = \"Blah blah.\"))\n\n \n\n \n \n \n tinytable_ha046bgbtwi89mlsbee9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also add markers in individual cells by providing coordinates:\n\ntt(x, notes = list(\n a = list(i = 0:1, j = 1, text = \"Blah.\"),\n b = \"Blah blah.\"\n )\n)\n\n \n\n \n \n \n tinytable_s12ak4tyt8ter0yf1p8s\n \n \n \n \n \n\n \n \n \n \n \n \n mpga\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 a\n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nIn Quarto, one should always specify captions cross-references using chunk options, and should not use the caption argument. This is because Quarto automatically post-processes tables, and may introduce conflict with the captions inserted by tinytable. For example:\n@tbl-blah shows that...\n\n```{r}\n#| label: tbl-blah\n#| tbl-cap: \"Blah blah blah\"\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n```\nAnd here is the rendered version of the code chunk above:\nTable 1 shows that…\n\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_7hi2bd21j18k926of1md\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21 \n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93 \n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOne exception to the injunction above is when rendering a Quarto document to LaTeX using theme_tt(\"multipage\")\". In that case, one must avoid using the Quarto chunk option, because these options trigger Quarto post-processing that will conflict with the longtblr environment used to split long tables across multiple pages.\nThe alternative is to use to refer to tables using standard LaTeX syntax: \\ref{tbl-ex-multipage}. Then, use the caption argument in tt() to specify both the label and the caption:\n\ntt(iris, caption = \"Example table.\\\\label{tbl-ex-multipage}\") |>\n theme_tt(\"multipage\")\n\nFor standalone tables in any format (i.e., outside Quarto), you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")\n\n\n\n\nTo insert LaTeX-style mathematical expressions in a tinytable, we enclose the expression in dollar signs: $...$. The expression will then rendered as a mathematical expression by MathJax (for HTML), LaTeX, or Pandoc. Do not forget to double escape any backslashes.\n\ndat <- data.frame(Math = c(\n \"$x^2 + y^2 = z^2$\",\n \"$\\\\frac{1}{2}$\"\n))\ntt(dat) |> style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_isaaf0vgzl5xh9gp701y\n \n \n \n \n \n\n \n \n \n \n \n \n Math\n \n \n \n \n \n $x^2 + y^2 = z^2$\n \n \n $\\frac{1}{2}$ \n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nManual line breaks work sligthly different in LaTeX (PDF) or HTML. This table shows the two strategies. For HTML, we insert a <br> tag. For LaTeX, we wrap the string in curly braces {}, and then insert two (escaped) backslashes: \\\\\\\\\n\nd <- data.frame(\n \"{Sed ut \\\\\\\\ perspiciatis unde}\",\n \"dicta sunt<br> explicabo. Nemo\"\n) |> setNames(c(\"LaTeX line break\", \"HTML line break\"))\ntt(d, width = 1)\n\n \n\n \n \n \n tinytable_htmwzuh5krh1lzrl0k3k\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX line break\n HTML line break\n \n \n \n \n \n {Sed ut \\\\ perspiciatis unde}\n dicta sunt explicabo. Nemo\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\ntinytable can produce tables in HTML, Word, Markdown, LaTeX, Typst, PDF, or PNG format. An appropriate output format for printing is automatically selected based on (1) whether the function is called interactively, (2) is called within RStudio, and (3) the output format of the Rmarkdown or Quarto document, if applicable. Alternatively, users can specify the print format in print() or by setting a global option:\n\ntt(x) |> print(\"markdown\")\ntt(x) |> print(\"html\")\ntt(x) |> print(\"latex\")\n\noptions(tinytable_print_output = \"markdown\")\n\nWith the save_tt() function, users can also save tables directly to PNG (images), PDF or Word documents, and to any of the basic formats. All we need to do is supply a valid file name with the appropriate extension (ex: .png, .html, .pdf, etc.):\ntt(x) |> save_tt(\"path/to/file.png\")\ntt(x) |> save_tt(\"path/to/file.pdf\")\ntt(x) |> save_tt(\"path/to/file.docx\")\ntt(x) |> save_tt(\"path/to/file.html\")\ntt(x) |> save_tt(\"path/to/file.tex\")\ntt(x) |> save_tt(\"path/to/file.md\")\nsave_tt() can also return a string with the table in it, for further processing in R. In the first case, the table is printed to console with cat(). In the second case, it returns as a single string as an R object.\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5)) |>\n print(\"markdown\")\n\n+------+-----+------+-----+------+\n| | Foo | Bar |\n+------+-----+------+-----+------+\n| mpg | cyl | disp | hp | drat |\n+======+=====+======+=====+======+\n| 21 | 6 | 160 | 110 | 3.9 |\n+------+-----+------+-----+------+\n| 21 | 6 | 160 | 110 | 3.9 |\n+------+-----+------+-----+------+\n| Hello |\n+------+-----+------+-----+------+\n| 22.8 | 4 | 108 | 93 | 3.85 |\n+------+-----+------+-----+------+\n| 21.4 | 6 | 258 | 110 | 3.08 |\n+------+-----+------+-----+------+\n| 18.7 | 8 | 360 | 175 | 3.15 |\n+------+-----+------+-----+------+\n| 18.1 | 6 | 225 | 105 | 2.76 |\n+------+-----+------+-----+------+\n| 14.3 | 8 | 360 | 245 | 3.21 |\n+------+-----+------+-----+------+\n| World |\n+------+-----+------+-----+------+\n| 24.4 | 4 | 147 | 62 | 3.69 |\n+------+-----+------+-----+------+\n| 22.8 | 4 | 141 | 95 | 3.92 |\n+------+-----+------+-----+------+\n| 19.2 | 6 | 168 | 123 | 3.92 |\n+------+-----+------+-----+------+ \n\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5)) |>\n save_tt(\"markdown\")\n\n[1] \"+------+-----+------+-----+------+\\n| | Foo | Bar |\\n+------+-----+------+-----+------+\\n| mpg | cyl | disp | hp | drat |\\n+======+=====+======+=====+======+\\n| 21 | 6 | 160 | 110 | 3.9 |\\n+------+-----+------+-----+------+\\n| 21 | 6 | 160 | 110 | 3.9 |\\n+------+-----+------+-----+------+\\n| Hello |\\n+------+-----+------+-----+------+\\n| 22.8 | 4 | 108 | 93 | 3.85 |\\n+------+-----+------+-----+------+\\n| 21.4 | 6 | 258 | 110 | 3.08 |\\n+------+-----+------+-----+------+\\n| 18.7 | 8 | 360 | 175 | 3.15 |\\n+------+-----+------+-----+------+\\n| 18.1 | 6 | 225 | 105 | 2.76 |\\n+------+-----+------+-----+------+\\n| 14.3 | 8 | 360 | 245 | 3.21 |\\n+------+-----+------+-----+------+\\n| World |\\n+------+-----+------+-----+------+\\n| 24.4 | 4 | 147 | 62 | 3.69 |\\n+------+-----+------+-----+------+\\n| 22.8 | 4 | 141 | 95 | 3.92 |\\n+------+-----+------+-----+------+\\n| 19.2 | 6 | 168 | 123 | 3.92 |\\n+------+-----+------+-----+------+\"\n\n\n\n\n\nTables can be explored, modified, and combined using many of the usual base R functions:\n\na <- tt(mtcars[1:2, 1:2])\na\n\n \n\n \n \n \n tinytable_qy7tj3t6ooi61o3bsvrv\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ndim(a)\n\n[1] 2 2\n\nncol(a)\n\n[1] 2\n\nnrow(a)\n\n[1] 2\n\ncolnames(a)\n\n[1] \"mpg\" \"cyl\"\n\n\nRename columns:\n\ncolnames(a) <- c(\"a\", \"b\")\na\n\n \n\n \n \n \n tinytable_15sfy2ik91untrro80cw\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\n\nTables can be combined with the usual rbind() function:\n\na <- tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\nb <- tt(mtcars[4:5, 8:10]) \n\nrbind(a, b)\n\n \n\n \n \n \n tinytable_b13r59k353bxqr5y624n\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1 \n 0 \n 3 \n \n \n \n \n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(a, b) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_q1lqfpc81lzpzgxus9mv\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nThe rbind2() S4 method is slightly more flexible than rbind(), as it supports arguments headers and use.names.\nOmit y header:\n\nrbind2(a, b, headers = FALSE)\n\n \n\n \n \n \n tinytable_mhftw64g9ixqo50k1jtf\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nBind tables by position rather than column names:\n\nrbind2(a, b, use_names = FALSE)\n\n \n\n \n \n \n tinytable_zu2dmq0pc8fohcnpiaxk\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21 \n 6 \n \n \n \n 21 \n 6 \n \n \n \n 22.8\n 4 \n \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -644,7 +644,7 @@ "href": "vignettes/tinytable.html#width", "title": "Tiny Tables", "section": "", - "text": "The width arguments indicating what proportion of the line width the table should cover. This argument accepts a number between 0 and 1 to control the whole table width, or a vector of numeric values between 0 and 1, representing each column.\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_wf42pnnubfgmmb4u4p4h\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, width = 1)\n\n \n\n \n \n \n tinytable_kz6axqhxh8kxwezyzecc\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can control individual columns by supplying a vector. In that case, the sum of width elements determines the full table width. For example, this table takes 70% of available width, with the first column 3 times as large as the other ones.\n\ntt(x, width = c(.3, .1, .1, .1, .1))\n\n \n\n \n \n \n tinytable_fk4o5lx9iai5hkawjg93\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen the sum of the width vector exceeds 1, it is automatically normalized to full-width. This is convenient when we only want to specify column width in relative terms:\n\ntt(x, width = c(3, 2, 1, 1, 1))\n\n \n\n \n \n \n tinytable_s5puwk4q7nwbnr7k8avb\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen specifying a table width, the text is automatically wrapped to appropriate size:\n\nlorem <- data.frame(\n Lorem = \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\",\n Ipsum = \" Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\"\n)\n\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_xoyf73mi0785zdcf0i3r\n \n \n \n \n \n\n \n \n \n \n \n \n Lorem\n Ipsum\n \n \n \n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.", + "text": "The width arguments indicating what proportion of the line width the table should cover. This argument accepts a number between 0 and 1 to control the whole table width, or a vector of numeric values between 0 and 1, representing each column.\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_1zq0m1pws5ko61e6fx30\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ntt(x, width = 1)\n\n \n\n \n \n \n tinytable_b7vn14rd7675honi0g5l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can control individual columns by supplying a vector. In that case, the sum of width elements determines the full table width. For example, this table takes 70% of available width, with the first column 3 times as large as the other ones.\n\ntt(x, width = c(.3, .1, .1, .1, .1))\n\n \n\n \n \n \n tinytable_lvk8gxcluzb6bzt6ihha\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen the sum of the width vector exceeds 1, it is automatically normalized to full-width. This is convenient when we only want to specify column width in relative terms:\n\ntt(x, width = c(3, 2, 1, 1, 1))\n\n \n\n \n \n \n tinytable_eip64npgge4wm0r4czhp\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen specifying a table width, the text is automatically wrapped to appropriate size:\n\nlorem <- data.frame(\n Lorem = \"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\",\n Ipsum = \" Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\"\n)\n\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_kt9yi7dmizkkh2mvkwry\n \n \n \n \n \n\n \n \n \n \n \n \n Lorem\n Ipsum\n \n \n \n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -656,7 +656,7 @@ "href": "vignettes/tinytable.html#footnotes", "title": "Tiny Tables", "section": "", - "text": "The notes argument accepts single strings or named lists of strings:\n\nn <- \"Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\"\n\ntt(lorem, notes = n, width = 1)\n\n \n\n \n \n \n tinytable_ztpvefvbeipyp4sdqpc2\n \n \n \n \n \n\n \n \n A full-width table with wrapped text in cells and a footnote.\n \n \n \n Lorem\n Ipsum\n \n \n Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\nWhen notes is a named list, the names are used as identifiers and displayed as superscripts:\n\ntt(x, notes = list(a = \"Blah.\", b = \"Blah blah.\"))\n\n \n\n \n \n \n tinytable_qb4qx3hp1rg0d9vw9gxx\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also add markers in individual cells by providing coordinates:\n\ntt(x, notes = list(\n a = list(i = 0:1, j = 1, text = \"Blah.\"),\n b = \"Blah blah.\"\n )\n)\n\n \n\n \n \n \n tinytable_6fyfut21ftmpev2mesp4\n \n \n \n \n \n\n \n \n \n \n \n \n mpga\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 a\n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "The notes argument accepts single strings or named lists of strings:\n\nn <- \"Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\"\n\ntt(lorem, notes = n, width = 1)\n\n \n\n \n \n \n tinytable_l6sw7dyot3eqcb69k803\n \n \n \n \n \n\n \n \n A full-width table with wrapped text in cells and a footnote.\n \n \n \n Lorem\n Ipsum\n \n \n Fusce id ipsum consequat ante pellentesque iaculis eu a ipsum. Mauris id ex in nulla consectetur aliquam. In nec tempus diam. Aliquam arcu nibh, dapibus id ex vestibulum, feugiat consequat erat. Morbi feugiat dapibus malesuada. Quisque vel ullamcorper felis. Aenean a sem at nisi tempor pretium sit amet quis lacus.\n \n \n Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.\n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.\n \n \n \n \n\n \n\n \n\n\n\n\nWhen notes is a named list, the names are used as identifiers and displayed as superscripts:\n\ntt(x, notes = list(a = \"Blah.\", b = \"Blah blah.\"))\n\n \n\n \n \n \n tinytable_ha046bgbtwi89mlsbee9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also add markers in individual cells by providing coordinates:\n\ntt(x, notes = list(\n a = list(i = 0:1, j = 1, text = \"Blah.\"),\n b = \"Blah blah.\"\n )\n)\n\n \n\n \n \n \n tinytable_s12ak4tyt8ter0yf1p8s\n \n \n \n \n \n\n \n \n \n \n \n \n mpga\n cyl\n disp\n hp\n drat\n \n \n a Blah.\nb Blah blah.\n \n \n 21 a\n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -668,7 +668,7 @@ "href": "vignettes/tinytable.html#captions-and-cross-references", "title": "Tiny Tables", "section": "", - "text": "In Quarto, one should always specify captions cross-references using chunk options, and should not use the caption argument. This is because Quarto automatically post-processes tables, and may introduce conflict with the captions inserted by tinytable. For example:\n@tbl-blah shows that...\n\n```{r}\n#| label: tbl-blah\n#| tbl-cap: \"Blah blah blah\"\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n```\nAnd here is the rendered version of the code chunk above:\nTable 1 shows that…\n\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_055r5to5c26453w2i9zl\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21 \n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93 \n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOne exception to the injunction above is when rendering a Quarto document to LaTeX using theme_tt(\"multipage\")\". In that case, one must avoid using the Quarto chunk option, because these options trigger Quarto post-processing that will conflict with the longtblr environment used to split long tables across multiple pages.\nThe alternative is to use to refer to tables using standard LaTeX syntax: \\ref{tbl-ex-multipage}. Then, use the caption argument in tt() to specify both the label and the caption:\n\ntt(iris, caption = \"Example table.\\\\label{tbl-ex-multipage}\") |>\n theme_tt(\"multipage\")\n\nFor standalone tables in any format (i.e., outside Quarto), you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")", + "text": "In Quarto, one should always specify captions cross-references using chunk options, and should not use the caption argument. This is because Quarto automatically post-processes tables, and may introduce conflict with the captions inserted by tinytable. For example:\n@tbl-blah shows that...\n\n```{r}\n#| label: tbl-blah\n#| tbl-cap: \"Blah blah blah\"\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n```\nAnd here is the rendered version of the code chunk above:\nTable 1 shows that…\n\nlibrary(tinytable)\ntt(mtcars[1:4, 1:4])\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_7hi2bd21j18k926of1md\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21 \n 6\n 160\n 110\n \n \n 21 \n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93 \n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nOne exception to the injunction above is when rendering a Quarto document to LaTeX using theme_tt(\"multipage\")\". In that case, one must avoid using the Quarto chunk option, because these options trigger Quarto post-processing that will conflict with the longtblr environment used to split long tables across multiple pages.\nThe alternative is to use to refer to tables using standard LaTeX syntax: \\ref{tbl-ex-multipage}. Then, use the caption argument in tt() to specify both the label and the caption:\n\ntt(iris, caption = \"Example table.\\\\label{tbl-ex-multipage}\") |>\n theme_tt(\"multipage\")\n\nFor standalone tables in any format (i.e., outside Quarto), you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -680,7 +680,7 @@ "href": "vignettes/tinytable.html#math", "title": "Tiny Tables", "section": "", - "text": "To insert LaTeX-style mathematical expressions in a tinytable, we enclose the expression in dollar signs: $...$. The expression will then rendered as a mathematical expression by MathJax (for HTML), LaTeX, or Pandoc. Do not forget to double escape any backslashes.\n\ndat <- data.frame(Math = c(\n \"$x^2 + y^2 = z^2$\",\n \"$\\\\frac{1}{2}$\"\n))\ntt(dat) |> style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_9w9uc2kb5v43oag5fd2u\n \n \n \n \n \n\n \n \n \n \n \n \n Math\n \n \n \n \n \n $x^2 + y^2 = z^2$\n \n \n $\\frac{1}{2}$", + "text": "To insert LaTeX-style mathematical expressions in a tinytable, we enclose the expression in dollar signs: $...$. The expression will then rendered as a mathematical expression by MathJax (for HTML), LaTeX, or Pandoc. Do not forget to double escape any backslashes.\n\ndat <- data.frame(Math = c(\n \"$x^2 + y^2 = z^2$\",\n \"$\\\\frac{1}{2}$\"\n))\ntt(dat) |> style_tt(j = 1, align = \"c\")\n\n \n\n \n \n \n tinytable_isaaf0vgzl5xh9gp701y\n \n \n \n \n \n\n \n \n \n \n \n \n Math\n \n \n \n \n \n $x^2 + y^2 = z^2$\n \n \n $\\frac{1}{2}$", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -692,7 +692,7 @@ "href": "vignettes/tinytable.html#line-breaks-and-text-wrapping", "title": "Tiny Tables", "section": "", - "text": "Manual line breaks work sligthly different in LaTeX (PDF) or HTML. This table shows the two strategies. For HTML, we insert a <br> tag. For LaTeX, we wrap the string in curly braces {}, and then insert two (escaped) backslashes: \\\\\\\\\n\nd <- data.frame(\n \"{Sed ut \\\\\\\\ perspiciatis unde}\",\n \"dicta sunt<br> explicabo. Nemo\"\n) |> setNames(c(\"LaTeX line break\", \"HTML line break\"))\ntt(d, width = 1)\n\n \n\n \n \n \n tinytable_j3jztxkf1kkbjjlt9hpg\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX line break\n HTML line break\n \n \n \n \n \n {Sed ut \\\\ perspiciatis unde}\n dicta sunt explicabo. Nemo", + "text": "Manual line breaks work sligthly different in LaTeX (PDF) or HTML. This table shows the two strategies. For HTML, we insert a <br> tag. For LaTeX, we wrap the string in curly braces {}, and then insert two (escaped) backslashes: \\\\\\\\\n\nd <- data.frame(\n \"{Sed ut \\\\\\\\ perspiciatis unde}\",\n \"dicta sunt<br> explicabo. Nemo\"\n) |> setNames(c(\"LaTeX line break\", \"HTML line break\"))\ntt(d, width = 1)\n\n \n\n \n \n \n tinytable_htmwzuh5krh1lzrl0k3k\n \n \n \n \n \n\n \n \n \n \n \n \n LaTeX line break\n HTML line break\n \n \n \n \n \n {Sed ut \\\\ perspiciatis unde}\n dicta sunt explicabo. Nemo", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -716,7 +716,7 @@ "href": "vignettes/tinytable.html#combination-and-exploration", "title": "Tiny Tables", "section": "", - "text": "Tables can be explored, modified, and combined using many of the usual base R functions:\n\na <- tt(mtcars[1:2, 1:2])\na\n\n \n\n \n \n \n tinytable_kyl9oty8yu72pyedx7kw\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ndim(a)\n\n[1] 2 2\n\nncol(a)\n\n[1] 2\n\nnrow(a)\n\n[1] 2\n\ncolnames(a)\n\n[1] \"mpg\" \"cyl\"\n\n\nRename columns:\n\ncolnames(a) <- c(\"a\", \"b\")\na\n\n \n\n \n \n \n tinytable_otlukq6iuqveldxlci34\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\n\nTables can be combined with the usual rbind() function:\n\na <- tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\nb <- tt(mtcars[4:5, 8:10]) \n\nrbind(a, b)\n\n \n\n \n \n \n tinytable_au4f7f70jncfxa3zgv0b\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1 \n 0 \n 3 \n \n \n \n \n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(a, b) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_vk0nuew5t50s7syj3i35\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nThe rbind2() S4 method is slightly more flexible than rbind(), as it supports arguments headers and use.names.\nOmit y header:\n\nrbind2(a, b, headers = FALSE)\n\n \n\n \n \n \n tinytable_mowlpehl09d5kyedouom\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nBind tables by position rather than column names:\n\nrbind2(a, b, use_names = FALSE)\n\n \n\n \n \n \n tinytable_p8y7ldghg19lbsif8fo3\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21 \n 6 \n \n \n \n 21 \n 6 \n \n \n \n 22.8\n 4 \n \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", + "text": "Tables can be explored, modified, and combined using many of the usual base R functions:\n\na <- tt(mtcars[1:2, 1:2])\na\n\n \n\n \n \n \n tinytable_qy7tj3t6ooi61o3bsvrv\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\ndim(a)\n\n[1] 2 2\n\nncol(a)\n\n[1] 2\n\nnrow(a)\n\n[1] 2\n\ncolnames(a)\n\n[1] \"mpg\" \"cyl\"\n\n\nRename columns:\n\ncolnames(a) <- c(\"a\", \"b\")\na\n\n \n\n \n \n \n tinytable_15sfy2ik91untrro80cw\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n \n \n \n \n \n 21\n 6\n \n \n 21\n 6\n \n \n \n \n\n \n\n \n\n\n\n\nTables can be combined with the usual rbind() function:\n\na <- tt(mtcars[1:3, 1:2], caption = \"Combine two tiny tables.\")\nb <- tt(mtcars[4:5, 8:10]) \n\nrbind(a, b)\n\n \n\n \n \n \n tinytable_b13r59k353bxqr5y624n\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1 \n 0 \n 3 \n \n \n \n \n 0 \n 0 \n 3 \n \n \n \n \n\n \n\n \n\n\n\nrbind(a, b) |> format_tt(replace = \"\")\n\n \n\n \n \n \n tinytable_q1lqfpc81lzpzgxus9mv\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 21\n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n vs\n am\n gear\n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nThe rbind2() S4 method is slightly more flexible than rbind(), as it supports arguments headers and use.names.\nOmit y header:\n\nrbind2(a, b, headers = FALSE)\n\n \n\n \n \n \n tinytable_mhftw64g9ixqo50k1jtf\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n vs\n am\n gear\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 21 \n 6\n \n \n \n \n \n 22.8\n 4\n \n \n \n \n \n \n \n 1\n 0\n 3\n \n \n \n \n 0\n 0\n 3\n \n \n \n \n\n \n\n \n\n\n\n\nBind tables by position rather than column names:\n\nrbind2(a, b, use_names = FALSE)\n\n \n\n \n \n \n tinytable_zu2dmq0pc8fohcnpiaxk\n \n \n \n \n \n\n \n \n \n \n Combine two tiny tables.\n \n mpg\n cyl\n gear\n \n \n \n \n \n 21 \n 6 \n \n \n \n 21 \n 6 \n \n \n \n 22.8\n 4 \n \n \n \n vs \n am\n gear\n \n \n 1 \n 0 \n 3 \n \n \n 0 \n 0 \n 3", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -728,7 +728,7 @@ "href": "vignettes/group.html", "title": "Groups and labels", "section": "", - "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\nThe group_tt() function can label groups of rows (i) or columns (j).\n\n\nThe i argument accepts a named list of integers. The numbers identify the positions where row group labels are to be inserted. The names includes the text that should be inserted:\n\ndat <- mtcars[1:9, 1:8]\n\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7))\n\n \n\n \n \n \n tinytable_14t7fpfwoigo6niumz5m\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style group rows in the same way as regular rows:\n\ntt(dat) |> \n group_tt(\n i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n color = \"white\",\n background = \"gray\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_dretfkz87899pydo5luk\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(dat) |> \n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_w5uuoew91upeh4mp2h82\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nHere is a table with both row and column headers, as well as some styling:\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |> \n group_tt(\n i = list(\"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7),\n j = list(\"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n background = \"teal\",\n color = \"white\") |>\n style_tt(i = -1, color = \"teal\")\n\n \n\n \n \n \n tinytable_2a0kwnxeoauk7oevrvq9\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also stack several extra headers on top of one another:\n\ntt(x) |>\n group_tt(j = list(\"Foo\" = 2:3, \"Bar\" = 5)) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 4:5))\n\n \n\n \n \n \n tinytable_zp9ex7y7goab99kryn6j\n \n \n \n \n \n\n \n \n \n \n\nHello\n \nWorld\n\n\n \nFoo\n \nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "library(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\nThe group_tt() function can label groups of rows (i) or columns (j).\n\n\nThe i argument accepts a named list of integers. The numbers identify the positions where row group labels are to be inserted. The names includes the text that should be inserted:\n\ndat <- mtcars[1:9, 1:8]\n\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7))\n\n \n\n \n \n \n tinytable_l7gd65v3j44u9u81q7mg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style group rows in the same way as regular rows:\n\ntt(dat) |> \n group_tt(\n i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n color = \"white\",\n background = \"gray\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_v2yzwfbdz74zzgus65n5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe 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:\n\ntt(dat) |> \n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_663jeggk9vdwsxa4d8mm\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nHere is a table with both row and column headers, as well as some styling:\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |> \n group_tt(\n i = list(\"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7),\n j = list(\"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n background = \"teal\",\n color = \"white\") |>\n style_tt(i = -1, color = \"teal\")\n\n \n\n \n \n \n tinytable_wtr50wgr478cw5368dia\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also stack several extra headers on top of one another:\n\ntt(x) |>\n group_tt(j = list(\"Foo\" = 2:3, \"Bar\" = 5)) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 4:5))\n\n \n\n \n \n \n tinytable_gjzgtrqqcaj4pb69lcs4\n \n \n \n \n \n\n \n \n \n \n\nHello\n \nWorld\n\n\n \nFoo\n \nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -740,7 +740,7 @@ "href": "vignettes/group.html#rows", "title": "Groups and labels", "section": "", - "text": "The i argument accepts a named list of integers. The numbers identify the positions where row group labels are to be inserted. The names includes the text that should be inserted:\n\ndat <- mtcars[1:9, 1:8]\n\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7))\n\n \n\n \n \n \n tinytable_14t7fpfwoigo6niumz5m\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style group rows in the same way as regular rows:\n\ntt(dat) |> \n group_tt(\n i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n color = \"white\",\n background = \"gray\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_dretfkz87899pydo5luk\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1", + "text": "The i argument accepts a named list of integers. The numbers identify the positions where row group labels are to be inserted. The names includes the text that should be inserted:\n\ndat <- mtcars[1:9, 1:8]\n\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7))\n\n \n\n \n \n \n tinytable_l7gd65v3j44u9u81q7mg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style group rows in the same way as regular rows:\n\ntt(dat) |> \n group_tt(\n i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n color = \"white\",\n background = \"gray\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_v2yzwfbdz74zzgus65n5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -752,7 +752,7 @@ "href": "vignettes/group.html#columns", "title": "Groups and labels", "section": "", - "text": "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:\n\ntt(dat) |> \n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_w5uuoew91upeh4mp2h82\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nHere is a table with both row and column headers, as well as some styling:\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |> \n group_tt(\n i = list(\"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7),\n j = list(\"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n background = \"teal\",\n color = \"white\") |>\n style_tt(i = -1, color = \"teal\")\n\n \n\n \n \n \n tinytable_2a0kwnxeoauk7oevrvq9\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also stack several extra headers on top of one another:\n\ntt(x) |>\n group_tt(j = list(\"Foo\" = 2:3, \"Bar\" = 5)) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 4:5))\n\n \n\n \n \n \n tinytable_zp9ex7y7goab99kryn6j\n \n \n \n \n \n\n \n \n \n \n\nHello\n \nWorld\n\n\n \nFoo\n \nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "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:\n\ntt(dat) |> \n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_663jeggk9vdwsxa4d8mm\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nHere is a table with both row and column headers, as well as some styling:\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |> \n group_tt(\n i = list(\"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7),\n j = list(\"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7)) |>\n style_tt(\n i = c(3, 5, 9),\n align = \"c\",\n background = \"teal\",\n color = \"white\") |>\n style_tt(i = -1, color = \"teal\")\n\n \n\n \n \n \n tinytable_wtr50wgr478cw5368dia\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.62\n 16.5\n 0\n \n \n 21 \n 6\n 160\n 110\n 3.9 \n 2.88\n 17 \n 0\n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n 2.32\n 18.6\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.21\n 19.4\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17 \n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.2\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.8\n 0\n \n \n 24.4\n 4\n 147\n 62 \n 3.69\n 3.19\n 20 \n 1\n \n \n 22.8\n 4\n 141\n 95 \n 3.92\n 3.15\n 22.9\n 1\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also stack several extra headers on top of one another:\n\ntt(x) |>\n group_tt(j = list(\"Foo\" = 2:3, \"Bar\" = 5)) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 4:5))\n\n \n\n \n \n \n tinytable_gjzgtrqqcaj4pb69lcs4\n \n \n \n \n \n\n \n \n \n \n\nHello\n \nWorld\n\n\n \nFoo\n \nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -764,7 +764,7 @@ "href": "vignettes/style.html", "title": "Style", "section": "", - "text": "The main styling function for the tinytable package is style_tt(). Via this function, you can access three main interfaces to customize tables:\n\nA general interface to frequently used style choices which works for both HTML and LaTeX (PDF): colors, font style and size, row and column spans, etc. This is accessed through several distinct arguments in the style_tt() function, such as italic, color, etc.\nA specialized interface which allows users to use the powerful tabularray package to customize LaTeX tables. This is accessed by passing tabularray settings as strings to the tabularray_inner and tabularray_outer arguments of style_tt().\nA specialized interface which allows users to use the powerful Bootstrap framework to customize HTML tables. This is accessed by passing CSS declarations and rules to the bootstrap_css and bootstrap_css_rule arguments of style_tt().\n\nThese functions can be used to customize rows, columns, or individual cells. They control many features, including:\n\nText color\nBackground color\nWidths\nHeights\nAlignment\nText Wrapping\nColumn and Row Spacing\nCell Merging\nMulti-row or column spans\nBorder Styling\nFont Styling: size, underline, italic, bold, strikethrough, etc.\nHeader Customization\n\nThe style_*() functions can modify individual cells, or entire columns and rows. The portion of the table that is styled is determined by the i (rows) and j (columns) arguments.\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo style individual cells, we use the style_cell() function. The first two arguments—i and j—identify the cells of interest, by row and column numbers respectively. To style a cell in the 2nd row and 3rd column, we can do:\n\ntt(x) |>\n style_tt(\n i = 2,\n j = 3,\n background = \"black\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_jlt78kr33h5ekdtduj8l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe i and j accept vectors of integers to modify several cells at once:\n\ntt(x) |>\n style_tt(\n i = 2:3,\n j = c(1, 3, 4),\n italic = TRUE,\n color = \"orange\")\n\n \n\n \n \n \n tinytable_ca9t8ow9isdsow1zjjpg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style all cells in a table by omitting both the i and j arguments:\n\ntt(x) |> style_tt(color = \"orange\")\n\n \n\n \n \n \n tinytable_achngqvzmeh63zepkv73\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire rows by omitting the j argument:\n\ntt(x) |> style_tt(i = 1:2, color = \"orange\")\n\n \n\n \n \n \n tinytable_wz59x3z9t7k9rd2jpev0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire columns by omitting the i argument:\n\ntt(x) |> style_tt(j = c(2, 4), bold = TRUE)\n\n \n\n \n \n \n tinytable_68oqy0ojfruew0lgncia\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe j argument accepts integer vectors, character vectors, but also a string with a Perl-style regular expression, which makes it easier to select columns by name:\n\ntt(x) |> style_tt(j = c(\"mpg\", \"drat\"), color = \"orange\")\n\n \n\n \n \n \n tinytable_pibjtubnt22llmwgla2g\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> style_tt(j = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_mkmtgm171sk0v3c7lj9x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere we use a “negative lookahead” to exclude certain columns:\n\ntt(x) |> style_tt(j = \"^(?!drat|mpg)\", color = \"orange\")\n\n \n\n \n \n \n tinytable_8jq7k1q7byictt2wx7jr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nOf course, we can also call the style_tt() function several times to apply different styles to different parts of the table:\n\ntt(x) |> \n style_tt(i = 1, j = 1:2, color = \"orange\") |>\n style_tt(i = 1, j = 3:4, color = \"green\")\n\n \n\n \n \n \n tinytable_zewad9lbj76p861w1ssj\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe color and background arguments in the style_tt() function are used for specifying the text color and the background color for cells of a table created by the tt() function. This argument plays a crucial role in enhancing the visual appeal and readability of the table, whether it’s rendered in LaTeX or HTML format. The way we specify colors differs slightly between the two formats:\nFor HTML Output:\n\nHex Codes: You can specify colors using hexadecimal codes, which consist of a # followed by 6 characters (e.g., #CC79A7). This allows for a wide range of colors.\nKeywords: There’s also the option to use color keywords for convenience. The supported keywords are basic color names like black, red, blue, etc.\n\nFor LaTeX Output:\n\nHexadecimal Codes: Similar to HTML, you can use hexadecimal codes. However, in LaTeX, you need to include these codes as strings (e.g., \"#CC79A7\").\nKeywords: LaTeX supports a different set of color keywords, which include standard colors like black, red, blue, as well as additional ones like cyan, darkgray, lightgray, etc.\nColor Blending: An advanced feature in LaTeX is color blending, which can be achieved using the xcolor package. You can blend colors by specifying ratios (e.g., white!80!blue or green!20!red).\nLuminance Levels: The ninecolors package in LaTeX offers colors with predefined luminance levels, allowing for more nuanced color choices (e.g., “azure4”, “magenta8”).\n\nNote that the keywords used in LaTeX and HTML are slightly different.\n\ntt(x) |> style_tt(i = 1:4, j = 1, color = \"#FF5733\")\n\n \n\n \n \n \n tinytable_j9go0k2l31logiq8fj4x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nNote that when using Hex codes in a LaTeX table, we need extra declarations in the LaTeX preamble. See ?tt for details.\n\n\n\nTo align columns, we use a single character, or a string where each letter represents a column:\n\ndat <- data.frame(\n a = c(\"a\", \"aa\", \"aaa\"),\n b = c(\"b\", \"bb\", \"bbb\"),\n c = c(\"c\", \"cc\", \"ccc\"))\n\ntt(dat) |> style_tt(j = 1:3, align = \"c\")\n\n \n\n \n \n \n tinytable_g6n0fes6ivukqsj6ee8e\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |> style_tt(j = 1:3, align = \"lcr\")\n\n \n\n \n \n \n tinytable_pd8ttkracfu5cfj5qvpb\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\n\nIn LaTeX documents (only), we can use decimal-alignment:\n\nz <- data.frame(pi = c(pi * 100, pi * 1000, pi * 10000, pi * 100000))\ntt(z) |>\n format_tt(j = 1, digits = 8, num_fmt = \"significant_cell\") |>\n style_tt(j = 1, align = \"d\")\n\n \n\n \n \n \n tinytable_kebnu2ougblalhvl1mx9\n \n \n \n \n \n\n \n \n \n \n \n \n pi\n \n \n \n \n \n 314.15927\n \n \n 3141.5927\n \n \n 31415.927\n \n \n 314159.27\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe font size is specified in em units.\n\ntt(x) |> style_tt(j = \"mpg|hp|qsec\", fontsize = 1.5)\n\n \n\n \n \n \n tinytable_bi21zxzuxzylxko1f475\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nSometimes, it can be useful to make a cell stretch across multiple colums or rows, for example when we want to insert a label. To achieve this, we can use the colspan argument. Here, we make the 2nd cell of the 2nd row stretch across three columns and two rows:\n\ntt(x)|> style_tt(\n i = 2, j = 2,\n colspan = 3,\n rowspan = 2,\n align = \"c\",\n alignv = \"m\",\n color = \"white\",\n background = \"black\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_ee9higwjrqwy5x0atou2\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere is the original table for comparison:\n\ntt(x)\n\n \n\n \n \n \n tinytable_z7b01b6ivb4d05n2h4si\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nSpanning cells can be particularly useful when we want to suppress redundant labels:\n\ntab <- aggregate(mpg ~ cyl + am, FUN = mean, data = mtcars)\ntab <- tab[order(tab$cyl, tab$am),]\ntab\n\n cyl am mpg\n1 4 0 22.90000\n4 4 1 28.07500\n2 6 0 19.12500\n5 6 1 20.56667\n3 8 0 15.05000\n6 8 1 15.40000\n\ntt(tab, digits = 2) |>\n style_tt(i = c(1, 3, 5), j = 1, rowspan = 2, alignv = \"t\")\n\n \n\n \n \n \n tinytable_3ne1csibkzw4bp4lbsja\n \n \n \n \n \n\n \n \n \n \n \n \n cyl\n am\n mpg\n \n \n \n \n \n 4\n 0\n 23\n \n \n 4\n 1\n 28\n \n \n 6\n 0\n 19\n \n \n 6\n 1\n 21\n \n \n 8\n 0\n 15\n \n \n 8\n 1\n 15\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe header can be omitted from the table by deleting the column names in the x data frame:\n\nk <- x\ncolnames(k) <- NULL\ntt(k)\n\n \n\n \n \n \n tinytable_smdqgwepet2hi20f2mrf\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe first is row 0, and higher level headers (ex: column spanning labels) have negative indices like -1. They can be styled as expected:\n\ntt(x) |> style_tt(i = 0, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_gefye105as1ijzs41yg6\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen styling columns without specifying i, the headers are styled in accordance with the rest of the column:\n\ntt(x) |> style_tt(j = 2:3, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_xzclij2soizbf0b1byck\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nWe can use the standard which function from Base R to create indices and apply conditional stying on rows. And we can use a regular expression in j to apply conditional styling on columns:\n\nk <- mtcars[1:10, c(\"mpg\", \"am\", \"vs\")]\n\ntt(k) |> \n style_tt(\n i = which(k$am == k$vs),\n background = \"teal\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_596t8jextrfxrum5rth1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n am\n vs\n \n \n \n \n \n 21 \n 1\n 0\n \n \n 21 \n 1\n 0\n \n \n 22.8\n 1\n 1\n \n \n 21.4\n 0\n 1\n \n \n 18.7\n 0\n 0\n \n \n 18.1\n 0\n 1\n \n \n 14.3\n 0\n 0\n \n \n 24.4\n 0\n 1\n \n \n 22.8\n 0\n 1\n \n \n 19.2\n 0\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe color, background, and fontsize arguments are vectorized. This allows easy specification of different colors in a single call:\n\ntt(x) |>\n style_tt(\n i = 1:4,\n color = c(\"red\", \"blue\", \"green\", \"orange\"))\n\n \n\n \n \n \n tinytable_du27258hojwsnw12kio1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen using a single value for a vectorized argument, it gets applied to all values:\n\ntt(x) |>\n style_tt(\n j = 2:3,\n color = c(\"orange\", \"green\"),\n background = \"black\")\n\n \n\n \n \n \n tinytable_rjvme3us7msc1c8evbot\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also produce more complex heatmap-like tables to illustrate different font sizes in em units:\n\n# font sizes\nfs <- seq(.1, 2, length.out = 20)\n\n# headless table\nk <- data.frame(matrix(fs, ncol = 5))\ncolnames(k) <- NULL\n\n# colors\nbg <- hcl.colors(20, \"Inferno\")\nfg <- ifelse(as.matrix(k) < 1.7, tail(bg, 1), head(bg, 1))\n\n# table\ntt(k, width = .7, theme = \"void\") |>\n style_tt(j = 1:5, align = \"ccccc\") |>\n style_tt(\n i = 1:4,\n j = 1:5,\n color = fg,\n background = bg,\n fontsize = fs)\n\n \n\n \n \n \n tinytable_ckp69kdxozsi9cpkzqin\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 0.1\n 0.5\n 0.9\n 1.3\n 1.7\n \n \n 0.2\n 0.6\n 1.0\n 1.4\n 1.8\n \n \n 0.3\n 0.7\n 1.1\n 1.5\n 1.9\n \n \n 0.4\n 0.8\n 1.2\n 1.6\n 2.0\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe style_tt function allows us to customize the borders that surround eacell of a table, as well horizontal and vertical rules. To control these lines, we use the line, line_width, and line_color arguments. Here’s a brief overview of each of these arguments:\n\nline: This argument specifies where solid lines should be drawn. It is a string that can consist of the following characters:\n\n\"t\": Draw a line at the top of the cell, row, or column.\n\"b\": Draw a line at the bottom of the cell, row, or column.\n\"l\": Draw a line at the left side of the cell, row, or column.\n\"r\": Draw a line at the right side of the cell, row, or column.\nYou can combine these characters to draw lines on multiple sides, such as \"tbl\" to draw lines at the top, bottom, and left sides of a cell.\n\nline_width: This argument controls the width of the solid lines in em units (default: 0.1 em). You can adjust this value to make the lines thicker or thinner.\nline_color: Specifies the color of the solid lines. You can use color names, hexadecimal codes, or other color specifications to define the line color.\n\nHere is an example where we draw lines around every border (“t”, “b”, “l”, and “r”) of specified cells.\n\ntt(x, theme = \"void\") |>\n style_tt(\n i = 0:3,\n j = 1:3,\n line = \"tblr\",\n line_width = 0.4,\n line_color = \"orange\")\n\n \n\n \n \n \n tinytable_4bqf0c55h4tlapu7bo38\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here is an example with horizontal rules:\n\ntt(x, theme = \"void\") |>\n style_tt(i = 0, line = \"t\", line_color = \"orange\", line_width = 0.4) |>\n style_tt(i = 0, line = \"b\", line_color = \"purple\", line_width = 0.2) |>\n style_tt(i = 4, line = \"b\", line_color = \"orange\", line_width = 0.4)\n\n \n\n \n \n \n tinytable_gxmat82efhww1e6j7v39\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ndat <- data.frame(1:2, 3:4, 5:6, 7:8)\ncolnames(dat) <- NULL\n\ntt(dat, theme = \"void\") |> \n style_tt(\n line = \"tblr\", line_color = \"white\", line_width = 0.5,\n background = \"blue\", color = \"white\")\n\n \n\n \n \n \n tinytable_d77sgoudy1iok64hm21x\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 1\n 3\n 5\n 7\n \n \n 2\n 4\n 6\n 8\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThere is no argument in style_tt() to control the padding of cells. Thankfully, this is easy to control using CSS and tabularray options:\n\ntt(x) |> style_tt(\n i = 1:5,\n bootstrap_css = \"padding-right: .2em; padding-top: 2em;\",\n tabularray_inner = \"rowsep={2em}, colsep = {.2em}\"\n)\n\n \n\n \n \n \n tinytable_62zlmplpdndn70d31j7u\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nStyling for Markdown and Word tables is more limited than for the other formats. In particular:\n\nThe only supported arguments are: bold, italic, and strikeout.\nHeaders inserted by group_tt() cannot be styled using the style_tt() function.\n\nThese limitations are due to the fact that there is no markdown syntax for the other options (ex: colors and background), and that we create Word documents by converting a markdown table to .docx via the Pandoc software.\nOne workaround is to style the group headers directly in their definition by using markdown syntax:\n\nmtcars[1:4, 1:4] |>\n tt() |>\n group_tt(i = list(\"*Hello*\" = 1, \"__World__\" = 3)) |>\n print(\"markdown\")\n\n+------+-----+------+-----+\n| mpg | cyl | disp | hp |\n+======+=====+======+=====+\n| *Hello* |\n+------+-----+------+-----+\n| 21 | 6 | 160 | 110 |\n+------+-----+------+-----+\n| 21 | 6 | 160 | 110 |\n+------+-----+------+-----+\n| __World__ |\n+------+-----+------+-----+\n| 22.8 | 4 | 108 | 93 |\n+------+-----+------+-----+\n| 21.4 | 6 | 258 | 110 |\n+------+-----+------+-----+", + "text": "The main styling function for the tinytable package is style_tt(). Via this function, you can access three main interfaces to customize tables:\n\nA general interface to frequently used style choices which works for both HTML and LaTeX (PDF): colors, font style and size, row and column spans, etc. This is accessed through several distinct arguments in the style_tt() function, such as italic, color, etc.\nA specialized interface which allows users to use the powerful tabularray package to customize LaTeX tables. This is accessed by passing tabularray settings as strings to the tabularray_inner and tabularray_outer arguments of style_tt().\nA specialized interface which allows users to use the powerful Bootstrap framework to customize HTML tables. This is accessed by passing CSS declarations and rules to the bootstrap_css and bootstrap_css_rule arguments of style_tt().\n\nThese functions can be used to customize rows, columns, or individual cells. They control many features, including:\n\nText color\nBackground color\nWidths\nHeights\nAlignment\nText Wrapping\nColumn and Row Spacing\nCell Merging\nMulti-row or column spans\nBorder Styling\nFont Styling: size, underline, italic, bold, strikethrough, etc.\nHeader Customization\n\nThe style_*() functions can modify individual cells, or entire columns and rows. The portion of the table that is styled is determined by the i (rows) and j (columns) arguments.\n\nlibrary(tinytable)\noptions(tinytable_tt_digits = 3)\noptions(tinytable_theme_placement_latex_float = \"H\")\nx <- mtcars[1:4, 1:5]\n\n\n\nTo style individual cells, we use the style_cell() function. The first two arguments—i and j—identify the cells of interest, by row and column numbers respectively. To style a cell in the 2nd row and 3rd column, we can do:\n\ntt(x) |>\n style_tt(\n i = 2,\n j = 3,\n background = \"black\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_hv98tbfahnbfbvlv3kto\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe i and j accept vectors of integers to modify several cells at once:\n\ntt(x) |>\n style_tt(\n i = 2:3,\n j = c(1, 3, 4),\n italic = TRUE,\n color = \"orange\")\n\n \n\n \n \n \n tinytable_iji3oxqla4m8cs9h1hd5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style all cells in a table by omitting both the i and j arguments:\n\ntt(x) |> style_tt(color = \"orange\")\n\n \n\n \n \n \n tinytable_v61u9930p4dtsr2aeb1d\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire rows by omitting the j argument:\n\ntt(x) |> style_tt(i = 1:2, color = \"orange\")\n\n \n\n \n \n \n tinytable_1jyvic47jejq6ntwvto4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire columns by omitting the i argument:\n\ntt(x) |> style_tt(j = c(2, 4), bold = TRUE)\n\n \n\n \n \n \n tinytable_enlqppjgo191003nvai9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe j argument accepts integer vectors, character vectors, but also a string with a Perl-style regular expression, which makes it easier to select columns by name:\n\ntt(x) |> style_tt(j = c(\"mpg\", \"drat\"), color = \"orange\")\n\n \n\n \n \n \n tinytable_y3hgr6hwwiicwh857ihe\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> style_tt(j = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_oock179i44ar3t4w6nrr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere we use a “negative lookahead” to exclude certain columns:\n\ntt(x) |> style_tt(j = \"^(?!drat|mpg)\", color = \"orange\")\n\n \n\n \n \n \n tinytable_xxo4mvnkwox0q8ti4b06\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nOf course, we can also call the style_tt() function several times to apply different styles to different parts of the table:\n\ntt(x) |> \n style_tt(i = 1, j = 1:2, color = \"orange\") |>\n style_tt(i = 1, j = 3:4, color = \"green\")\n\n \n\n \n \n \n tinytable_8v2yezuxapghyiqiqx66\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe color and background arguments in the style_tt() function are used for specifying the text color and the background color for cells of a table created by the tt() function. This argument plays a crucial role in enhancing the visual appeal and readability of the table, whether it’s rendered in LaTeX or HTML format. The way we specify colors differs slightly between the two formats:\nFor HTML Output:\n\nHex Codes: You can specify colors using hexadecimal codes, which consist of a # followed by 6 characters (e.g., #CC79A7). This allows for a wide range of colors.\nKeywords: There’s also the option to use color keywords for convenience. The supported keywords are basic color names like black, red, blue, etc.\n\nFor LaTeX Output:\n\nHexadecimal Codes: Similar to HTML, you can use hexadecimal codes. However, in LaTeX, you need to include these codes as strings (e.g., \"#CC79A7\").\nKeywords: LaTeX supports a different set of color keywords, which include standard colors like black, red, blue, as well as additional ones like cyan, darkgray, lightgray, etc.\nColor Blending: An advanced feature in LaTeX is color blending, which can be achieved using the xcolor package. You can blend colors by specifying ratios (e.g., white!80!blue or green!20!red).\nLuminance Levels: The ninecolors package in LaTeX offers colors with predefined luminance levels, allowing for more nuanced color choices (e.g., “azure4”, “magenta8”).\n\nNote that the keywords used in LaTeX and HTML are slightly different.\n\ntt(x) |> style_tt(i = 1:4, j = 1, color = \"#FF5733\")\n\n \n\n \n \n \n tinytable_quncb6fszzh3yl7gk1mz\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nNote that when using Hex codes in a LaTeX table, we need extra declarations in the LaTeX preamble. See ?tt for details.\n\n\n\nTo align columns, we use a single character, or a string where each letter represents a column:\n\ndat <- data.frame(\n a = c(\"a\", \"aa\", \"aaa\"),\n b = c(\"b\", \"bb\", \"bbb\"),\n c = c(\"c\", \"cc\", \"ccc\"))\n\ntt(dat) |> style_tt(j = 1:3, align = \"c\")\n\n \n\n \n \n \n tinytable_sx18fokeiyo4uqjayjoq\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |> style_tt(j = 1:3, align = \"lcr\")\n\n \n\n \n \n \n tinytable_0y4odto8lrmwrgk7gito\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\n\nIn LaTeX documents (only), we can use decimal-alignment:\n\nz <- data.frame(pi = c(pi * 100, pi * 1000, pi * 10000, pi * 100000))\ntt(z) |>\n format_tt(j = 1, digits = 8, num_fmt = \"significant_cell\") |>\n style_tt(j = 1, align = \"d\")\n\n \n\n \n \n \n tinytable_l2s70tjyb008683uqwmn\n \n \n \n \n \n\n \n \n \n \n \n \n pi\n \n \n \n \n \n 314.15927\n \n \n 3141.5927\n \n \n 31415.927\n \n \n 314159.27\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe font size is specified in em units.\n\ntt(x) |> style_tt(j = \"mpg|hp|qsec\", fontsize = 1.5)\n\n \n\n \n \n \n tinytable_rw317bsl19vq6p32xgcg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nSometimes, it can be useful to make a cell stretch across multiple colums or rows, for example when we want to insert a label. To achieve this, we can use the colspan argument. Here, we make the 2nd cell of the 2nd row stretch across three columns and two rows:\n\ntt(x)|> style_tt(\n i = 2, j = 2,\n colspan = 3,\n rowspan = 2,\n align = \"c\",\n alignv = \"m\",\n color = \"white\",\n background = \"black\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_opmraltq8tedel9o9xly\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere is the original table for comparison:\n\ntt(x)\n\n \n\n \n \n \n tinytable_s78hfmrb7t2ydlhacwf9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nSpanning cells can be particularly useful when we want to suppress redundant labels:\n\ntab <- aggregate(mpg ~ cyl + am, FUN = mean, data = mtcars)\ntab <- tab[order(tab$cyl, tab$am),]\ntab\n\n cyl am mpg\n1 4 0 22.90000\n4 4 1 28.07500\n2 6 0 19.12500\n5 6 1 20.56667\n3 8 0 15.05000\n6 8 1 15.40000\n\ntt(tab, digits = 2) |>\n style_tt(i = c(1, 3, 5), j = 1, rowspan = 2, alignv = \"t\")\n\n \n\n \n \n \n tinytable_rvzbv3r3opz4aslp0ian\n \n \n \n \n \n\n \n \n \n \n \n \n cyl\n am\n mpg\n \n \n \n \n \n 4\n 0\n 23\n \n \n 4\n 1\n 28\n \n \n 6\n 0\n 19\n \n \n 6\n 1\n 21\n \n \n 8\n 0\n 15\n \n \n 8\n 1\n 15\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe header can be omitted from the table by deleting the column names in the x data frame:\n\nk <- x\ncolnames(k) <- NULL\ntt(k)\n\n \n\n \n \n \n tinytable_t60prwofjfcu9sb3fbuh\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe first is row 0, and higher level headers (ex: column spanning labels) have negative indices like -1. They can be styled as expected:\n\ntt(x) |> style_tt(i = 0, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_wij6vgpjpbt4robh0k6g\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen styling columns without specifying i, the headers are styled in accordance with the rest of the column:\n\ntt(x) |> style_tt(j = 2:3, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_kc94jt9uol842pzq4ofl\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nWe can use the standard which function from Base R to create indices and apply conditional stying on rows. And we can use a regular expression in j to apply conditional styling on columns:\n\nk <- mtcars[1:10, c(\"mpg\", \"am\", \"vs\")]\n\ntt(k) |> \n style_tt(\n i = which(k$am == k$vs),\n background = \"teal\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_nhieafr3el6vhcsik62l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n am\n vs\n \n \n \n \n \n 21 \n 1\n 0\n \n \n 21 \n 1\n 0\n \n \n 22.8\n 1\n 1\n \n \n 21.4\n 0\n 1\n \n \n 18.7\n 0\n 0\n \n \n 18.1\n 0\n 1\n \n \n 14.3\n 0\n 0\n \n \n 24.4\n 0\n 1\n \n \n 22.8\n 0\n 1\n \n \n 19.2\n 0\n 1\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe color, background, and fontsize arguments are vectorized. This allows easy specification of different colors in a single call:\n\ntt(x) |>\n style_tt(\n i = 1:4,\n color = c(\"red\", \"blue\", \"green\", \"orange\"))\n\n \n\n \n \n \n tinytable_qh5g9qnj1yw6s4ium5qp\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen using a single value for a vectorized argument, it gets applied to all values:\n\ntt(x) |>\n style_tt(\n j = 2:3,\n color = c(\"orange\", \"green\"),\n background = \"black\")\n\n \n\n \n \n \n tinytable_xhvbx8w5aesms5fkwkpq\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also produce more complex heatmap-like tables to illustrate different font sizes in em units:\n\n# font sizes\nfs <- seq(.1, 2, length.out = 20)\n\n# headless table\nk <- data.frame(matrix(fs, ncol = 5))\ncolnames(k) <- NULL\n\n# colors\nbg <- hcl.colors(20, \"Inferno\")\nfg <- ifelse(as.matrix(k) < 1.7, tail(bg, 1), head(bg, 1))\n\n# table\ntt(k, width = .7, theme = \"void\") |>\n style_tt(j = 1:5, align = \"ccccc\") |>\n style_tt(\n i = 1:4,\n j = 1:5,\n color = fg,\n background = bg,\n fontsize = fs)\n\n \n\n \n \n \n tinytable_6vbs668uhfwodimfjh9y\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 0.1\n 0.5\n 0.9\n 1.3\n 1.7\n \n \n 0.2\n 0.6\n 1.0\n 1.4\n 1.8\n \n \n 0.3\n 0.7\n 1.1\n 1.5\n 1.9\n \n \n 0.4\n 0.8\n 1.2\n 1.6\n 2.0\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThe style_tt function allows us to customize the borders that surround eacell of a table, as well horizontal and vertical rules. To control these lines, we use the line, line_width, and line_color arguments. Here’s a brief overview of each of these arguments:\n\nline: This argument specifies where solid lines should be drawn. It is a string that can consist of the following characters:\n\n\"t\": Draw a line at the top of the cell, row, or column.\n\"b\": Draw a line at the bottom of the cell, row, or column.\n\"l\": Draw a line at the left side of the cell, row, or column.\n\"r\": Draw a line at the right side of the cell, row, or column.\nYou can combine these characters to draw lines on multiple sides, such as \"tbl\" to draw lines at the top, bottom, and left sides of a cell.\n\nline_width: This argument controls the width of the solid lines in em units (default: 0.1 em). You can adjust this value to make the lines thicker or thinner.\nline_color: Specifies the color of the solid lines. You can use color names, hexadecimal codes, or other color specifications to define the line color.\n\nHere is an example where we draw lines around every border (“t”, “b”, “l”, and “r”) of specified cells.\n\ntt(x, theme = \"void\") |>\n style_tt(\n i = 0:3,\n j = 1:3,\n line = \"tblr\",\n line_width = 0.4,\n line_color = \"orange\")\n\n \n\n \n \n \n tinytable_tt4odl2cqynnw3nen2o4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here is an example with horizontal rules:\n\ntt(x, theme = \"void\") |>\n style_tt(i = 0, line = \"t\", line_color = \"orange\", line_width = 0.4) |>\n style_tt(i = 0, line = \"b\", line_color = \"purple\", line_width = 0.2) |>\n style_tt(i = 4, line = \"b\", line_color = \"orange\", line_width = 0.4)\n\n \n\n \n \n \n tinytable_jg3e0bpx5nf33a98z6jf\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ndat <- data.frame(1:2, 3:4, 5:6, 7:8)\ncolnames(dat) <- NULL\n\ntt(dat, theme = \"void\") |> \n style_tt(\n line = \"tblr\", line_color = \"white\", line_width = 0.5,\n background = \"blue\", color = \"white\")\n\n \n\n \n \n \n tinytable_yoc6f437690fa13zqtc0\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 1\n 3\n 5\n 7\n \n \n 2\n 4\n 6\n 8\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nThere is no argument in style_tt() to control the padding of cells. Thankfully, this is easy to control using CSS and tabularray options:\n\ntt(x) |> style_tt(\n i = 1:5,\n bootstrap_css = \"padding-right: .2em; padding-top: 2em;\",\n tabularray_inner = \"rowsep={2em}, colsep = {.2em}\"\n)\n\n \n\n \n \n \n tinytable_8pnlz89ftol3vgsuiv6k\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\n\n\nStyling for Markdown and Word tables is more limited than for the other formats. In particular:\n\nThe only supported arguments are: bold, italic, and strikeout.\nHeaders inserted by group_tt() cannot be styled using the style_tt() function.\n\nThese limitations are due to the fact that there is no markdown syntax for the other options (ex: colors and background), and that we create Word documents by converting a markdown table to .docx via the Pandoc software.\nOne workaround is to style the group headers directly in their definition by using markdown syntax:\n\nmtcars[1:4, 1:4] |>\n tt() |>\n group_tt(i = list(\"*Hello*\" = 1, \"__World__\" = 3)) |>\n print(\"markdown\")\n\n+------+-----+------+-----+\n| mpg | cyl | disp | hp |\n+======+=====+======+=====+\n| *Hello* |\n+------+-----+------+-----+\n| 21 | 6 | 160 | 110 |\n+------+-----+------+-----+\n| 21 | 6 | 160 | 110 |\n+------+-----+------+-----+\n| __World__ |\n+------+-----+------+-----+\n| 22.8 | 4 | 108 | 93 |\n+------+-----+------+-----+\n| 21.4 | 6 | 258 | 110 |\n+------+-----+------+-----+", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -776,7 +776,7 @@ "href": "vignettes/style.html#cells-rows-columns", "title": "Style", "section": "", - "text": "To style individual cells, we use the style_cell() function. The first two arguments—i and j—identify the cells of interest, by row and column numbers respectively. To style a cell in the 2nd row and 3rd column, we can do:\n\ntt(x) |>\n style_tt(\n i = 2,\n j = 3,\n background = \"black\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_jlt78kr33h5ekdtduj8l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe i and j accept vectors of integers to modify several cells at once:\n\ntt(x) |>\n style_tt(\n i = 2:3,\n j = c(1, 3, 4),\n italic = TRUE,\n color = \"orange\")\n\n \n\n \n \n \n tinytable_ca9t8ow9isdsow1zjjpg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style all cells in a table by omitting both the i and j arguments:\n\ntt(x) |> style_tt(color = \"orange\")\n\n \n\n \n \n \n tinytable_achngqvzmeh63zepkv73\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire rows by omitting the j argument:\n\ntt(x) |> style_tt(i = 1:2, color = \"orange\")\n\n \n\n \n \n \n tinytable_wz59x3z9t7k9rd2jpev0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire columns by omitting the i argument:\n\ntt(x) |> style_tt(j = c(2, 4), bold = TRUE)\n\n \n\n \n \n \n tinytable_68oqy0ojfruew0lgncia\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe j argument accepts integer vectors, character vectors, but also a string with a Perl-style regular expression, which makes it easier to select columns by name:\n\ntt(x) |> style_tt(j = c(\"mpg\", \"drat\"), color = \"orange\")\n\n \n\n \n \n \n tinytable_pibjtubnt22llmwgla2g\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> style_tt(j = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_mkmtgm171sk0v3c7lj9x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere we use a “negative lookahead” to exclude certain columns:\n\ntt(x) |> style_tt(j = \"^(?!drat|mpg)\", color = \"orange\")\n\n \n\n \n \n \n tinytable_8jq7k1q7byictt2wx7jr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nOf course, we can also call the style_tt() function several times to apply different styles to different parts of the table:\n\ntt(x) |> \n style_tt(i = 1, j = 1:2, color = \"orange\") |>\n style_tt(i = 1, j = 3:4, color = \"green\")\n\n \n\n \n \n \n tinytable_zewad9lbj76p861w1ssj\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "To style individual cells, we use the style_cell() function. The first two arguments—i and j—identify the cells of interest, by row and column numbers respectively. To style a cell in the 2nd row and 3rd column, we can do:\n\ntt(x) |>\n style_tt(\n i = 2,\n j = 3,\n background = \"black\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_hv98tbfahnbfbvlv3kto\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe i and j accept vectors of integers to modify several cells at once:\n\ntt(x) |>\n style_tt(\n i = 2:3,\n j = c(1, 3, 4),\n italic = TRUE,\n color = \"orange\")\n\n \n\n \n \n \n tinytable_iji3oxqla4m8cs9h1hd5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style all cells in a table by omitting both the i and j arguments:\n\ntt(x) |> style_tt(color = \"orange\")\n\n \n\n \n \n \n tinytable_v61u9930p4dtsr2aeb1d\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire rows by omitting the j argument:\n\ntt(x) |> style_tt(i = 1:2, color = \"orange\")\n\n \n\n \n \n \n tinytable_1jyvic47jejq6ntwvto4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can style entire columns by omitting the i argument:\n\ntt(x) |> style_tt(j = c(2, 4), bold = TRUE)\n\n \n\n \n \n \n tinytable_enlqppjgo191003nvai9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe j argument accepts integer vectors, character vectors, but also a string with a Perl-style regular expression, which makes it easier to select columns by name:\n\ntt(x) |> style_tt(j = c(\"mpg\", \"drat\"), color = \"orange\")\n\n \n\n \n \n \n tinytable_y3hgr6hwwiicwh857ihe\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> style_tt(j = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_oock179i44ar3t4w6nrr\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere we use a “negative lookahead” to exclude certain columns:\n\ntt(x) |> style_tt(j = \"^(?!drat|mpg)\", color = \"orange\")\n\n \n\n \n \n \n tinytable_xxo4mvnkwox0q8ti4b06\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nOf course, we can also call the style_tt() function several times to apply different styles to different parts of the table:\n\ntt(x) |> \n style_tt(i = 1, j = 1:2, color = \"orange\") |>\n style_tt(i = 1, j = 3:4, color = \"green\")\n\n \n\n \n \n \n tinytable_8v2yezuxapghyiqiqx66\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -788,7 +788,7 @@ "href": "vignettes/style.html#colors", "title": "Style", "section": "", - "text": "The color and background arguments in the style_tt() function are used for specifying the text color and the background color for cells of a table created by the tt() function. This argument plays a crucial role in enhancing the visual appeal and readability of the table, whether it’s rendered in LaTeX or HTML format. The way we specify colors differs slightly between the two formats:\nFor HTML Output:\n\nHex Codes: You can specify colors using hexadecimal codes, which consist of a # followed by 6 characters (e.g., #CC79A7). This allows for a wide range of colors.\nKeywords: There’s also the option to use color keywords for convenience. The supported keywords are basic color names like black, red, blue, etc.\n\nFor LaTeX Output:\n\nHexadecimal Codes: Similar to HTML, you can use hexadecimal codes. However, in LaTeX, you need to include these codes as strings (e.g., \"#CC79A7\").\nKeywords: LaTeX supports a different set of color keywords, which include standard colors like black, red, blue, as well as additional ones like cyan, darkgray, lightgray, etc.\nColor Blending: An advanced feature in LaTeX is color blending, which can be achieved using the xcolor package. You can blend colors by specifying ratios (e.g., white!80!blue or green!20!red).\nLuminance Levels: The ninecolors package in LaTeX offers colors with predefined luminance levels, allowing for more nuanced color choices (e.g., “azure4”, “magenta8”).\n\nNote that the keywords used in LaTeX and HTML are slightly different.\n\ntt(x) |> style_tt(i = 1:4, j = 1, color = \"#FF5733\")\n\n \n\n \n \n \n tinytable_j9go0k2l31logiq8fj4x\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nNote that when using Hex codes in a LaTeX table, we need extra declarations in the LaTeX preamble. See ?tt for details.", + "text": "The color and background arguments in the style_tt() function are used for specifying the text color and the background color for cells of a table created by the tt() function. This argument plays a crucial role in enhancing the visual appeal and readability of the table, whether it’s rendered in LaTeX or HTML format. The way we specify colors differs slightly between the two formats:\nFor HTML Output:\n\nHex Codes: You can specify colors using hexadecimal codes, which consist of a # followed by 6 characters (e.g., #CC79A7). This allows for a wide range of colors.\nKeywords: There’s also the option to use color keywords for convenience. The supported keywords are basic color names like black, red, blue, etc.\n\nFor LaTeX Output:\n\nHexadecimal Codes: Similar to HTML, you can use hexadecimal codes. However, in LaTeX, you need to include these codes as strings (e.g., \"#CC79A7\").\nKeywords: LaTeX supports a different set of color keywords, which include standard colors like black, red, blue, as well as additional ones like cyan, darkgray, lightgray, etc.\nColor Blending: An advanced feature in LaTeX is color blending, which can be achieved using the xcolor package. You can blend colors by specifying ratios (e.g., white!80!blue or green!20!red).\nLuminance Levels: The ninecolors package in LaTeX offers colors with predefined luminance levels, allowing for more nuanced color choices (e.g., “azure4”, “magenta8”).\n\nNote that the keywords used in LaTeX and HTML are slightly different.\n\ntt(x) |> style_tt(i = 1:4, j = 1, color = \"#FF5733\")\n\n \n\n \n \n \n tinytable_quncb6fszzh3yl7gk1mz\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nNote that when using Hex codes in a LaTeX table, we need extra declarations in the LaTeX preamble. See ?tt for details.", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -800,7 +800,7 @@ "href": "vignettes/style.html#alignment", "title": "Style", "section": "", - "text": "To align columns, we use a single character, or a string where each letter represents a column:\n\ndat <- data.frame(\n a = c(\"a\", \"aa\", \"aaa\"),\n b = c(\"b\", \"bb\", \"bbb\"),\n c = c(\"c\", \"cc\", \"ccc\"))\n\ntt(dat) |> style_tt(j = 1:3, align = \"c\")\n\n \n\n \n \n \n tinytable_g6n0fes6ivukqsj6ee8e\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |> style_tt(j = 1:3, align = \"lcr\")\n\n \n\n \n \n \n tinytable_pd8ttkracfu5cfj5qvpb\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\n\nIn LaTeX documents (only), we can use decimal-alignment:\n\nz <- data.frame(pi = c(pi * 100, pi * 1000, pi * 10000, pi * 100000))\ntt(z) |>\n format_tt(j = 1, digits = 8, num_fmt = \"significant_cell\") |>\n style_tt(j = 1, align = \"d\")\n\n \n\n \n \n \n tinytable_kebnu2ougblalhvl1mx9\n \n \n \n \n \n\n \n \n \n \n \n \n pi\n \n \n \n \n \n 314.15927\n \n \n 3141.5927\n \n \n 31415.927\n \n \n 314159.27", + "text": "To align columns, we use a single character, or a string where each letter represents a column:\n\ndat <- data.frame(\n a = c(\"a\", \"aa\", \"aaa\"),\n b = c(\"b\", \"bb\", \"bbb\"),\n c = c(\"c\", \"cc\", \"ccc\"))\n\ntt(dat) |> style_tt(j = 1:3, align = \"c\")\n\n \n\n \n \n \n tinytable_sx18fokeiyo4uqjayjoq\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |> style_tt(j = 1:3, align = \"lcr\")\n\n \n\n \n \n \n tinytable_0y4odto8lrmwrgk7gito\n \n \n \n \n \n\n \n \n \n \n \n \n a\n b\n c\n \n \n \n \n \n a \n b \n c \n \n \n aa \n bb \n cc \n \n \n aaa\n bbb\n ccc\n \n \n \n \n\n \n\n \n\n\n\n\nIn LaTeX documents (only), we can use decimal-alignment:\n\nz <- data.frame(pi = c(pi * 100, pi * 1000, pi * 10000, pi * 100000))\ntt(z) |>\n format_tt(j = 1, digits = 8, num_fmt = \"significant_cell\") |>\n style_tt(j = 1, align = \"d\")\n\n \n\n \n \n \n tinytable_l2s70tjyb008683uqwmn\n \n \n \n \n \n\n \n \n \n \n \n \n pi\n \n \n \n \n \n 314.15927\n \n \n 3141.5927\n \n \n 31415.927\n \n \n 314159.27", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -812,7 +812,7 @@ "href": "vignettes/style.html#font-size", "title": "Style", "section": "", - "text": "The font size is specified in em units.\n\ntt(x) |> style_tt(j = \"mpg|hp|qsec\", fontsize = 1.5)\n\n \n\n \n \n \n tinytable_bi21zxzuxzylxko1f475\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "The font size is specified in em units.\n\ntt(x) |> style_tt(j = \"mpg|hp|qsec\", fontsize = 1.5)\n\n \n\n \n \n \n tinytable_rw317bsl19vq6p32xgcg\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -824,7 +824,7 @@ "href": "vignettes/style.html#spanning-cells-merging-cells", "title": "Style", "section": "", - "text": "Sometimes, it can be useful to make a cell stretch across multiple colums or rows, for example when we want to insert a label. To achieve this, we can use the colspan argument. Here, we make the 2nd cell of the 2nd row stretch across three columns and two rows:\n\ntt(x)|> style_tt(\n i = 2, j = 2,\n colspan = 3,\n rowspan = 2,\n align = \"c\",\n alignv = \"m\",\n color = \"white\",\n background = \"black\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_ee9higwjrqwy5x0atou2\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere is the original table for comparison:\n\ntt(x)\n\n \n\n \n \n \n tinytable_z7b01b6ivb4d05n2h4si\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nSpanning cells can be particularly useful when we want to suppress redundant labels:\n\ntab <- aggregate(mpg ~ cyl + am, FUN = mean, data = mtcars)\ntab <- tab[order(tab$cyl, tab$am),]\ntab\n\n cyl am mpg\n1 4 0 22.90000\n4 4 1 28.07500\n2 6 0 19.12500\n5 6 1 20.56667\n3 8 0 15.05000\n6 8 1 15.40000\n\ntt(tab, digits = 2) |>\n style_tt(i = c(1, 3, 5), j = 1, rowspan = 2, alignv = \"t\")\n\n \n\n \n \n \n tinytable_3ne1csibkzw4bp4lbsja\n \n \n \n \n \n\n \n \n \n \n \n \n cyl\n am\n mpg\n \n \n \n \n \n 4\n 0\n 23\n \n \n 4\n 1\n 28\n \n \n 6\n 0\n 19\n \n \n 6\n 1\n 21\n \n \n 8\n 0\n 15\n \n \n 8\n 1\n 15", + "text": "Sometimes, it can be useful to make a cell stretch across multiple colums or rows, for example when we want to insert a label. To achieve this, we can use the colspan argument. Here, we make the 2nd cell of the 2nd row stretch across three columns and two rows:\n\ntt(x)|> style_tt(\n i = 2, j = 2,\n colspan = 3,\n rowspan = 2,\n align = \"c\",\n alignv = \"m\",\n color = \"white\",\n background = \"black\",\n bold = TRUE)\n\n \n\n \n \n \n tinytable_opmraltq8tedel9o9xly\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nHere is the original table for comparison:\n\ntt(x)\n\n \n\n \n \n \n tinytable_s78hfmrb7t2ydlhacwf9\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nSpanning cells can be particularly useful when we want to suppress redundant labels:\n\ntab <- aggregate(mpg ~ cyl + am, FUN = mean, data = mtcars)\ntab <- tab[order(tab$cyl, tab$am),]\ntab\n\n cyl am mpg\n1 4 0 22.90000\n4 4 1 28.07500\n2 6 0 19.12500\n5 6 1 20.56667\n3 8 0 15.05000\n6 8 1 15.40000\n\ntt(tab, digits = 2) |>\n style_tt(i = c(1, 3, 5), j = 1, rowspan = 2, alignv = \"t\")\n\n \n\n \n \n \n tinytable_rvzbv3r3opz4aslp0ian\n \n \n \n \n \n\n \n \n \n \n \n \n cyl\n am\n mpg\n \n \n \n \n \n 4\n 0\n 23\n \n \n 4\n 1\n 28\n \n \n 6\n 0\n 19\n \n \n 6\n 1\n 21\n \n \n 8\n 0\n 15\n \n \n 8\n 1\n 15", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -836,7 +836,7 @@ "href": "vignettes/style.html#headers", "title": "Style", "section": "", - "text": "The header can be omitted from the table by deleting the column names in the x data frame:\n\nk <- x\ncolnames(k) <- NULL\ntt(k)\n\n \n\n \n \n \n tinytable_smdqgwepet2hi20f2mrf\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe first is row 0, and higher level headers (ex: column spanning labels) have negative indices like -1. They can be styled as expected:\n\ntt(x) |> style_tt(i = 0, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_gefye105as1ijzs41yg6\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen styling columns without specifying i, the headers are styled in accordance with the rest of the column:\n\ntt(x) |> style_tt(j = 2:3, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_xzclij2soizbf0b1byck\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "The header can be omitted from the table by deleting the column names in the x data frame:\n\nk <- x\ncolnames(k) <- NULL\ntt(k)\n\n \n\n \n \n \n tinytable_t60prwofjfcu9sb3fbuh\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nThe first is row 0, and higher level headers (ex: column spanning labels) have negative indices like -1. They can be styled as expected:\n\ntt(x) |> style_tt(i = 0, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_wij6vgpjpbt4robh0k6g\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen styling columns without specifying i, the headers are styled in accordance with the rest of the column:\n\ntt(x) |> style_tt(j = 2:3, color = \"white\", background = \"black\")\n\n \n\n \n \n \n tinytable_kc94jt9uol842pzq4ofl\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -848,7 +848,7 @@ "href": "vignettes/style.html#conditional-styling", "title": "Style", "section": "", - "text": "We can use the standard which function from Base R to create indices and apply conditional stying on rows. And we can use a regular expression in j to apply conditional styling on columns:\n\nk <- mtcars[1:10, c(\"mpg\", \"am\", \"vs\")]\n\ntt(k) |> \n style_tt(\n i = which(k$am == k$vs),\n background = \"teal\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_596t8jextrfxrum5rth1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n am\n vs\n \n \n \n \n \n 21 \n 1\n 0\n \n \n 21 \n 1\n 0\n \n \n 22.8\n 1\n 1\n \n \n 21.4\n 0\n 1\n \n \n 18.7\n 0\n 0\n \n \n 18.1\n 0\n 1\n \n \n 14.3\n 0\n 0\n \n \n 24.4\n 0\n 1\n \n \n 22.8\n 0\n 1\n \n \n 19.2\n 0\n 1", + "text": "We can use the standard which function from Base R to create indices and apply conditional stying on rows. And we can use a regular expression in j to apply conditional styling on columns:\n\nk <- mtcars[1:10, c(\"mpg\", \"am\", \"vs\")]\n\ntt(k) |> \n style_tt(\n i = which(k$am == k$vs),\n background = \"teal\",\n color = \"white\")\n\n \n\n \n \n \n tinytable_nhieafr3el6vhcsik62l\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n am\n vs\n \n \n \n \n \n 21 \n 1\n 0\n \n \n 21 \n 1\n 0\n \n \n 22.8\n 1\n 1\n \n \n 21.4\n 0\n 1\n \n \n 18.7\n 0\n 0\n \n \n 18.1\n 0\n 1\n \n \n 14.3\n 0\n 0\n \n \n 24.4\n 0\n 1\n \n \n 22.8\n 0\n 1\n \n \n 19.2\n 0\n 1", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -860,7 +860,7 @@ "href": "vignettes/style.html#vectorized-styling-heatmaps", "title": "Style", "section": "", - "text": "The color, background, and fontsize arguments are vectorized. This allows easy specification of different colors in a single call:\n\ntt(x) |>\n style_tt(\n i = 1:4,\n color = c(\"red\", \"blue\", \"green\", \"orange\"))\n\n \n\n \n \n \n tinytable_du27258hojwsnw12kio1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen using a single value for a vectorized argument, it gets applied to all values:\n\ntt(x) |>\n style_tt(\n j = 2:3,\n color = c(\"orange\", \"green\"),\n background = \"black\")\n\n \n\n \n \n \n tinytable_rjvme3us7msc1c8evbot\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also produce more complex heatmap-like tables to illustrate different font sizes in em units:\n\n# font sizes\nfs <- seq(.1, 2, length.out = 20)\n\n# headless table\nk <- data.frame(matrix(fs, ncol = 5))\ncolnames(k) <- NULL\n\n# colors\nbg <- hcl.colors(20, \"Inferno\")\nfg <- ifelse(as.matrix(k) < 1.7, tail(bg, 1), head(bg, 1))\n\n# table\ntt(k, width = .7, theme = \"void\") |>\n style_tt(j = 1:5, align = \"ccccc\") |>\n style_tt(\n i = 1:4,\n j = 1:5,\n color = fg,\n background = bg,\n fontsize = fs)\n\n \n\n \n \n \n tinytable_ckp69kdxozsi9cpkzqin\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 0.1\n 0.5\n 0.9\n 1.3\n 1.7\n \n \n 0.2\n 0.6\n 1.0\n 1.4\n 1.8\n \n \n 0.3\n 0.7\n 1.1\n 1.5\n 1.9\n \n \n 0.4\n 0.8\n 1.2\n 1.6\n 2.0", + "text": "The color, background, and fontsize arguments are vectorized. This allows easy specification of different colors in a single call:\n\ntt(x) |>\n style_tt(\n i = 1:4,\n color = c(\"red\", \"blue\", \"green\", \"orange\"))\n\n \n\n \n \n \n tinytable_qh5g9qnj1yw6s4ium5qp\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWhen using a single value for a vectorized argument, it gets applied to all values:\n\ntt(x) |>\n style_tt(\n j = 2:3,\n color = c(\"orange\", \"green\"),\n background = \"black\")\n\n \n\n \n \n \n tinytable_xhvbx8w5aesms5fkwkpq\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nWe can also produce more complex heatmap-like tables to illustrate different font sizes in em units:\n\n# font sizes\nfs <- seq(.1, 2, length.out = 20)\n\n# headless table\nk <- data.frame(matrix(fs, ncol = 5))\ncolnames(k) <- NULL\n\n# colors\nbg <- hcl.colors(20, \"Inferno\")\nfg <- ifelse(as.matrix(k) < 1.7, tail(bg, 1), head(bg, 1))\n\n# table\ntt(k, width = .7, theme = \"void\") |>\n style_tt(j = 1:5, align = \"ccccc\") |>\n style_tt(\n i = 1:4,\n j = 1:5,\n color = fg,\n background = bg,\n fontsize = fs)\n\n \n\n \n \n \n tinytable_6vbs668uhfwodimfjh9y\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 0.1\n 0.5\n 0.9\n 1.3\n 1.7\n \n \n 0.2\n 0.6\n 1.0\n 1.4\n 1.8\n \n \n 0.3\n 0.7\n 1.1\n 1.5\n 1.9\n \n \n 0.4\n 0.8\n 1.2\n 1.6\n 2.0", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -872,7 +872,7 @@ "href": "vignettes/style.html#lines-borders", "title": "Style", "section": "", - "text": "The style_tt function allows us to customize the borders that surround eacell of a table, as well horizontal and vertical rules. To control these lines, we use the line, line_width, and line_color arguments. Here’s a brief overview of each of these arguments:\n\nline: This argument specifies where solid lines should be drawn. It is a string that can consist of the following characters:\n\n\"t\": Draw a line at the top of the cell, row, or column.\n\"b\": Draw a line at the bottom of the cell, row, or column.\n\"l\": Draw a line at the left side of the cell, row, or column.\n\"r\": Draw a line at the right side of the cell, row, or column.\nYou can combine these characters to draw lines on multiple sides, such as \"tbl\" to draw lines at the top, bottom, and left sides of a cell.\n\nline_width: This argument controls the width of the solid lines in em units (default: 0.1 em). You can adjust this value to make the lines thicker or thinner.\nline_color: Specifies the color of the solid lines. You can use color names, hexadecimal codes, or other color specifications to define the line color.\n\nHere is an example where we draw lines around every border (“t”, “b”, “l”, and “r”) of specified cells.\n\ntt(x, theme = \"void\") |>\n style_tt(\n i = 0:3,\n j = 1:3,\n line = \"tblr\",\n line_width = 0.4,\n line_color = \"orange\")\n\n \n\n \n \n \n tinytable_4bqf0c55h4tlapu7bo38\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here is an example with horizontal rules:\n\ntt(x, theme = \"void\") |>\n style_tt(i = 0, line = \"t\", line_color = \"orange\", line_width = 0.4) |>\n style_tt(i = 0, line = \"b\", line_color = \"purple\", line_width = 0.2) |>\n style_tt(i = 4, line = \"b\", line_color = \"orange\", line_width = 0.4)\n\n \n\n \n \n \n tinytable_gxmat82efhww1e6j7v39\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ndat <- data.frame(1:2, 3:4, 5:6, 7:8)\ncolnames(dat) <- NULL\n\ntt(dat, theme = \"void\") |> \n style_tt(\n line = \"tblr\", line_color = \"white\", line_width = 0.5,\n background = \"blue\", color = \"white\")\n\n \n\n \n \n \n tinytable_d77sgoudy1iok64hm21x\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 1\n 3\n 5\n 7\n \n \n 2\n 4\n 6\n 8", + "text": "The style_tt function allows us to customize the borders that surround eacell of a table, as well horizontal and vertical rules. To control these lines, we use the line, line_width, and line_color arguments. Here’s a brief overview of each of these arguments:\n\nline: This argument specifies where solid lines should be drawn. It is a string that can consist of the following characters:\n\n\"t\": Draw a line at the top of the cell, row, or column.\n\"b\": Draw a line at the bottom of the cell, row, or column.\n\"l\": Draw a line at the left side of the cell, row, or column.\n\"r\": Draw a line at the right side of the cell, row, or column.\nYou can combine these characters to draw lines on multiple sides, such as \"tbl\" to draw lines at the top, bottom, and left sides of a cell.\n\nline_width: This argument controls the width of the solid lines in em units (default: 0.1 em). You can adjust this value to make the lines thicker or thinner.\nline_color: Specifies the color of the solid lines. You can use color names, hexadecimal codes, or other color specifications to define the line color.\n\nHere is an example where we draw lines around every border (“t”, “b”, “l”, and “r”) of specified cells.\n\ntt(x, theme = \"void\") |>\n style_tt(\n i = 0:3,\n j = 1:3,\n line = \"tblr\",\n line_width = 0.4,\n line_color = \"orange\")\n\n \n\n \n \n \n tinytable_tt4odl2cqynnw3nen2o4\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\nAnd here is an example with horizontal rules:\n\ntt(x, theme = \"void\") |>\n style_tt(i = 0, line = \"t\", line_color = \"orange\", line_width = 0.4) |>\n style_tt(i = 0, line = \"b\", line_color = \"purple\", line_width = 0.2) |>\n style_tt(i = 4, line = \"b\", line_color = \"orange\", line_width = 0.4)\n\n \n\n \n \n \n tinytable_jg3e0bpx5nf33a98z6jf\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\n\n\ndat <- data.frame(1:2, 3:4, 5:6, 7:8)\ncolnames(dat) <- NULL\n\ntt(dat, theme = \"void\") |> \n style_tt(\n line = \"tblr\", line_color = \"white\", line_width = 0.5,\n background = \"blue\", color = \"white\")\n\n \n\n \n \n \n tinytable_yoc6f437690fa13zqtc0\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n 1\n 3\n 5\n 7\n \n \n 2\n 4\n 6\n 8", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -884,7 +884,7 @@ "href": "vignettes/style.html#cell-padding", "title": "Style", "section": "", - "text": "There is no argument in style_tt() to control the padding of cells. Thankfully, this is easy to control using CSS and tabularray options:\n\ntt(x) |> style_tt(\n i = 1:5,\n bootstrap_css = \"padding-right: .2em; padding-top: 2em;\",\n tabularray_inner = \"rowsep={2em}, colsep = {.2em}\"\n)\n\n \n\n \n \n \n tinytable_62zlmplpdndn70d31j7u\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", + "text": "There is no argument in style_tt() to control the padding of cells. Thankfully, this is easy to control using CSS and tabularray options:\n\ntt(x) |> style_tt(\n i = 1:5,\n bootstrap_css = \"padding-right: .2em; padding-top: 2em;\",\n tabularray_inner = \"rowsep={2em}, colsep = {.2em}\"\n)\n\n \n\n \n \n \n tinytable_8pnlz89ftol3vgsuiv6k\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 21 \n 6\n 160\n 110\n 3.9 \n \n \n 22.8\n 4\n 108\n 93 \n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08", "crumbs": [ "Tutorial (PDF)", "Tutorial", @@ -920,7 +920,7 @@ "href": "man/group_tt.html", "title": "tinytable", "section": "", - "text": "Spanning labels to identify groups of rows or columns\n\n\n\ngroup_tt(x, i = NULL, j = NULL, indent = 1, ...)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ni\n\n\nA named list of row indices to group. The names of the list will be used as labels.\n\n\n\n\nj\n\n\nA named list of column indices to group. The names of the list will be used as labels. See examples below. Note: empty labels must be a space: \" \".\n\n\n\n\nindent\n\n\ninteger number of pt to use when indenting the non-labelled rows.\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nWarning: The style_tt() can normally be used to style the group headers, as expected, but that feature is not available for Markdown and Word tables.\n\n\n\nAn object of class tt representing the table.\n\n\n\n\nlibrary(tinytable)\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5))\n\n \n\n \n \n \n tinytable_etags4019hq831nm7acf\n \n \n \n \n \n\n \n \n \n \n\n \nFoo\nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n \n \n 19.2\n 6\n 167.6\n 123\n 3.92\n \n \n \n \n\n \n\n \n\n\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) \n\n \n\n \n \n \n tinytable_mg8m6lvftxy8mjl1ujra\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |>\n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_uoviwg5ctd4qcwdwobb9\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\nx <- mtcars[1:5, 1:6]\ntt(x) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 3:4, \"Hello\"=5:6)) |>\n group_tt(j = list(\"Foo\" = 1:3, \"Bar\" = 4:6))\n\n \n\n \n \n \n tinytable_bqh6ydrds2r4c7c3m2s2\n \n \n \n \n \n\n \n \n \n \n\nFoo\nBar\n\n\nHello\nWorld\nHello\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.620\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.875\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.320\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.440", + "text": "Spanning labels to identify groups of rows or columns\n\n\n\ngroup_tt(x, i = NULL, j = NULL, indent = 1, ...)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ni\n\n\nA named list of row indices to group. The names of the list will be used as labels.\n\n\n\n\nj\n\n\nA named list of column indices to group. The names of the list will be used as labels. See examples below. Note: empty labels must be a space: \" \".\n\n\n\n\nindent\n\n\ninteger number of pt to use when indenting the non-labelled rows.\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nWarning: The style_tt() can normally be used to style the group headers, as expected, but that feature is not available for Markdown and Word tables.\n\n\n\nAn object of class tt representing the table.\n\n\n\n\nlibrary(tinytable)\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5))\n\n \n\n \n \n \n tinytable_cu55rhsbmmj0sg5hcvee\n \n \n \n \n \n\n \n \n \n \n\n \nFoo\nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n \n \n 19.2\n 6\n 167.6\n 123\n 3.92\n \n \n \n \n\n \n\n \n\n\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) \n\n \n\n \n \n \n tinytable_90t3b56f2hadcz6o1q8p\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |>\n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_miwue3m6isys93t209y4\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\nx <- mtcars[1:5, 1:6]\ntt(x) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 3:4, \"Hello\"=5:6)) |>\n group_tt(j = list(\"Foo\" = 1:3, \"Bar\" = 4:6))\n\n \n\n \n \n \n tinytable_b4zfo1mrn4xeynm9wzf9\n \n \n \n \n \n\n \n \n \n \n\nFoo\nBar\n\n\nHello\nWorld\nHello\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.620\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.875\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.320\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.440", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -932,7 +932,7 @@ "href": "man/group_tt.html#spanning-labels-to-identify-groups-of-rows-or-columns", "title": "tinytable", "section": "", - "text": "Spanning labels to identify groups of rows or columns\n\n\n\ngroup_tt(x, i = NULL, j = NULL, indent = 1, ...)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ni\n\n\nA named list of row indices to group. The names of the list will be used as labels.\n\n\n\n\nj\n\n\nA named list of column indices to group. The names of the list will be used as labels. See examples below. Note: empty labels must be a space: \" \".\n\n\n\n\nindent\n\n\ninteger number of pt to use when indenting the non-labelled rows.\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nWarning: The style_tt() can normally be used to style the group headers, as expected, but that feature is not available for Markdown and Word tables.\n\n\n\nAn object of class tt representing the table.\n\n\n\n\nlibrary(tinytable)\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5))\n\n \n\n \n \n \n tinytable_etags4019hq831nm7acf\n \n \n \n \n \n\n \n \n \n \n\n \nFoo\nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n \n \n 19.2\n 6\n 167.6\n 123\n 3.92\n \n \n \n \n\n \n\n \n\n\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) \n\n \n\n \n \n \n tinytable_mg8m6lvftxy8mjl1ujra\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |>\n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_uoviwg5ctd4qcwdwobb9\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\nx <- mtcars[1:5, 1:6]\ntt(x) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 3:4, \"Hello\"=5:6)) |>\n group_tt(j = list(\"Foo\" = 1:3, \"Bar\" = 4:6))\n\n \n\n \n \n \n tinytable_bqh6ydrds2r4c7c3m2s2\n \n \n \n \n \n\n \n \n \n \n\nFoo\nBar\n\n\nHello\nWorld\nHello\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.620\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.875\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.320\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.440", + "text": "Spanning labels to identify groups of rows or columns\n\n\n\ngroup_tt(x, i = NULL, j = NULL, indent = 1, ...)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ni\n\n\nA named list of row indices to group. The names of the list will be used as labels.\n\n\n\n\nj\n\n\nA named list of column indices to group. The names of the list will be used as labels. See examples below. Note: empty labels must be a space: \" \".\n\n\n\n\nindent\n\n\ninteger number of pt to use when indenting the non-labelled rows.\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nWarning: The style_tt() can normally be used to style the group headers, as expected, but that feature is not available for Markdown and Word tables.\n\n\n\nAn object of class tt representing the table.\n\n\n\n\nlibrary(tinytable)\n\n\ntt(mtcars[1:10, 1:5]) |>\n group_tt(\n i = list(\n \"Hello\" = 3,\n \"World\" = 8),\n j = list(\n \"Foo\" = 2:3,\n \"Bar\" = 4:5))\n\n \n\n \n \n \n tinytable_cu55rhsbmmj0sg5hcvee\n \n \n \n \n \n\n \n \n \n \n\n \nFoo\nBar\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n \n \n 19.2\n 6\n 167.6\n 123\n 3.92\n \n \n \n \n\n \n\n \n\n\n\ndat <- mtcars[1:9, 1:8]\ntt(dat) |>\n group_tt(i = list(\n \"I like (fake) hamburgers\" = 3,\n \"She prefers halloumi\" = 4,\n \"They love tofu\" = 7)) \n\n \n\n \n \n \n tinytable_90t3b56f2hadcz6o1q8p\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\ntt(dat) |>\n group_tt(\n j = list(\n \"Hamburgers\" = 1:3,\n \"Halloumi\" = 4:5,\n \"Tofu\" = 7))\n\n \n\n \n \n \n tinytable_miwue3m6isys93t209y4\n \n \n \n \n \n\n \n \n \n \n\nHamburgers\nHalloumi\n \nTofu\n \n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n qsec\n vs\n \n \n \n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.620\n 16.46\n 0\n \n \n 21.0\n 6\n 160.0\n 110\n 3.90\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108.0\n 93\n 3.85\n 2.320\n 18.61\n 1\n \n \n 21.4\n 6\n 258.0\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360.0\n 175\n 3.15\n 3.440\n 17.02\n 0\n \n \n 18.1\n 6\n 225.0\n 105\n 2.76\n 3.460\n 20.22\n 1\n \n \n 14.3\n 8\n 360.0\n 245\n 3.21\n 3.570\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.190\n 20.00\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.150\n 22.90\n 1\n \n \n \n \n\n \n\n \n\n\n\nx <- mtcars[1:5, 1:6]\ntt(x) |>\n group_tt(j = list(\"Hello\" = 1:2, \"World\" = 3:4, \"Hello\"=5:6)) |>\n group_tt(j = list(\"Foo\" = 1:3, \"Bar\" = 4:6))\n\n \n\n \n \n \n tinytable_b4zfo1mrn4xeynm9wzf9\n \n \n \n \n \n\n \n \n \n \n\nFoo\nBar\n\n\nHello\nWorld\nHello\n\n \n \n mpg\n cyl\n disp\n hp\n drat\n wt\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.620\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n 2.875\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.320\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.440", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -944,7 +944,7 @@ "href": "man/tt.html", "title": "tinytable", "section": "", - "text": "The tt function renders a table in different formats with various styling options: HTML, Markdown, LaTeX, Word, PDF, PNG, or Typst. The table can be customized with additional functions:\n\n\nstyle_tt(): style fonts, colors, alignment, etc.\n\n\nformat_tt(): format numbers, dates, strings, etc.\n\n\ngroup_tt(): row or column group labels.\n\n\ntheme_tt(): apply a collection of transformations to a tinytable.\n\n\nsave_tt(): save the table to a file or return the table as a string.\n\n\nprint(): print to a specific format, ex: print(x, “latex”)\n\n\ntinytable attempts to determine the appropriate way to print the table based on interactive use, RStudio availability, and output format in RMarkdown or Quarto documents. Users can call print(x, output=“markdown”) to print the table in a specific format. Alternatively, they can set a global option: options(“tinytable_print_output”=“markdown”)\n\n\n\ntt(\n x,\n digits = getOption(\"tinytable_tt_digits\", default = NULL),\n caption = NULL,\n notes = NULL,\n width = getOption(\"tinytable_tt_width\", default = NULL),\n theme = getOption(\"tinytable_tt_theme\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ndigits\n\n\nNumber of significant digits to keep for numeric variables. When digits is an integer, tt() calls format_tt(x, digits = digits) before proceeding to draw the table. Note that this will apply all default argument values of format_tt(), such as replacing NA by \"\". Users who need more control can use the format_tt() function instead.\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table. This argument should not be used in Quarto or Rmarkdown documents. In that context, please use the appropriate chunk options.\n\n\n\n\nnotes\n\n\nNotes to append to the bottom of the table. This argument accepts several different inputs:\n\n\nSingle string insert a single note: “blah blah”\n\n\nMultiple strings insert multiple notes sequentially: list(“Hello world”, “Foo bar”)\n\n\nA named list inserts a list with the name as superscript: list(“a” = list(“Hello World”))\n\n\nA named list with positions inserts markers as superscripts inside table cells: list(“a” = list(i = 0:1, j = 2, text = “Hello World”))\n\n\n\n\n\n\nwidth\n\n\nTable or column width.\n\n\nSingle numeric value smaller than or equal to 1 determines the full table width, in proportion of line width.\n\n\nNumeric vector of length equal to the number of columns in x determines the width of each column, in proportion of line width. If the sum of width exceeds 1, each element is divided by sum(width). This makes the table full-width with relative column sizes.\n\n\n\n\n\n\ntheme\n\n\nFunction or string.\n\n\nString: grid, resize, multipage, placement, striped, void, bootstrap, tabular\n\n\nFunction: Applied to the tinytable object.\n\n\n\n\n\n\n…\n\n\nAdditional arguments are ignored\n\n\n\n\n\n\nAn object of class tt representing the table.\nThe table object has S4 slots which hold information about the structure of the table. This meta-data can be accessed with the usual @ accessor. In general, modifying the content of these slots is not recommended, but it can be useful to some developers, such as those who want to force print to a specific output format without calling print().\n\n\n\nWhen rendering Quarto and Rmarkdown documents, tinytable will populate the LaTeX preamble automatically with all the required packages. For standalone LaTeX packages, these commands should be inserted in the preamble:\n\n\\usepackage{tabularray}\n\\usepackage{float}\n\\usepackage{graphicx}\n\\usepackage[normalem]{ulem}\n\\UseTblrLibrary{booktabs}\n\\newcommand{\\tinytableTabularrayUnderline}[1]{\\underline{#1}}\n\\newcommand{\\tinytableTabularrayStrikeout}[1]{\\sout{#1}}\n\\NewTableCommand{\\tinytableDefineColor}[3]{\\definecolor{#1}{#2}{#3}}\n\n\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_87jhu0hvppld9788btf5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_bo5mixdsxheh8ytmoxb4\n \n \n \n \n \n\n \n \n \n \n Data about cars.\n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x, notes = \"Hello World!\")\n\n \n\n \n \n \n tinytable_y0erq79z5slgp5591j9m\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n Hello World!\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\nfn <- list(i = 0:1, j = 2, text = \"Hello World!\")\ntab <- tt(x, notes = list(\"*\" = fn))\nprint(tab, \"latex\")\n\n\\begin{table}\n\\centering\n\\begin{talltblr}[ %% tabularray outer open\nentry=none,label=none,\nnote{*}={Hello World!},\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl\\textsuperscript{*} & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21.0 & 6\\textsuperscript{*} & 160 & 110 & 3.90 \\\\\n21.0 & 6 & 160 & 110 & 3.90 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{talltblr}\n\\end{table} \n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits=2)\n\n \n\n \n \n \n tinytable_ngwdoogofelcuszf0tic\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568", + "text": "The tt function renders a table in different formats with various styling options: HTML, Markdown, LaTeX, Word, PDF, PNG, or Typst. The table can be customized with additional functions:\n\n\nstyle_tt(): style fonts, colors, alignment, etc.\n\n\nformat_tt(): format numbers, dates, strings, etc.\n\n\ngroup_tt(): row or column group labels.\n\n\ntheme_tt(): apply a collection of transformations to a tinytable.\n\n\nsave_tt(): save the table to a file or return the table as a string.\n\n\nprint(): print to a specific format, ex: print(x, “latex”)\n\n\ntinytable attempts to determine the appropriate way to print the table based on interactive use, RStudio availability, and output format in RMarkdown or Quarto documents. Users can call print(x, output=“markdown”) to print the table in a specific format. Alternatively, they can set a global option: options(“tinytable_print_output”=“markdown”)\n\n\n\ntt(\n x,\n digits = getOption(\"tinytable_tt_digits\", default = NULL),\n caption = NULL,\n notes = NULL,\n width = getOption(\"tinytable_tt_width\", default = NULL),\n theme = getOption(\"tinytable_tt_theme\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ndigits\n\n\nNumber of significant digits to keep for numeric variables. When digits is an integer, tt() calls format_tt(x, digits = digits) before proceeding to draw the table. Note that this will apply all default argument values of format_tt(), such as replacing NA by \"\". Users who need more control can use the format_tt() function instead.\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table. This argument should not be used in Quarto or Rmarkdown documents. In that context, please use the appropriate chunk options.\n\n\n\n\nnotes\n\n\nNotes to append to the bottom of the table. This argument accepts several different inputs:\n\n\nSingle string insert a single note: “blah blah”\n\n\nMultiple strings insert multiple notes sequentially: list(“Hello world”, “Foo bar”)\n\n\nA named list inserts a list with the name as superscript: list(“a” = list(“Hello World”))\n\n\nA named list with positions inserts markers as superscripts inside table cells: list(“a” = list(i = 0:1, j = 2, text = “Hello World”))\n\n\n\n\n\n\nwidth\n\n\nTable or column width.\n\n\nSingle numeric value smaller than or equal to 1 determines the full table width, in proportion of line width.\n\n\nNumeric vector of length equal to the number of columns in x determines the width of each column, in proportion of line width. If the sum of width exceeds 1, each element is divided by sum(width). This makes the table full-width with relative column sizes.\n\n\n\n\n\n\ntheme\n\n\nFunction or string.\n\n\nString: grid, resize, multipage, placement, striped, void, bootstrap, tabular\n\n\nFunction: Applied to the tinytable object.\n\n\n\n\n\n\n…\n\n\nAdditional arguments are ignored\n\n\n\n\n\n\nAn object of class tt representing the table.\nThe table object has S4 slots which hold information about the structure of the table. This meta-data can be accessed with the usual @ accessor. In general, modifying the content of these slots is not recommended, but it can be useful to some developers, such as those who want to force print to a specific output format without calling print().\n\n\n\nWhen rendering Quarto and Rmarkdown documents, tinytable will populate the LaTeX preamble automatically with all the required packages. For standalone LaTeX packages, these commands should be inserted in the preamble:\n\n\\usepackage{tabularray}\n\\usepackage{float}\n\\usepackage{graphicx}\n\\usepackage[normalem]{ulem}\n\\UseTblrLibrary{booktabs}\n\\newcommand{\\tinytableTabularrayUnderline}[1]{\\underline{#1}}\n\\newcommand{\\tinytableTabularrayStrikeout}[1]{\\sout{#1}}\n\\NewTableCommand{\\tinytableDefineColor}[3]{\\definecolor{#1}{#2}{#3}}\n\n\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_hc59npqb4vegpqmpve85\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_eiwoduhsfqvzpugkpf2g\n \n \n \n \n \n\n \n \n \n \n Data about cars.\n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x, notes = \"Hello World!\")\n\n \n\n \n \n \n tinytable_boyj9jmokttwxkbxrnbn\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n Hello World!\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\nfn <- list(i = 0:1, j = 2, text = \"Hello World!\")\ntab <- tt(x, notes = list(\"*\" = fn))\nprint(tab, \"latex\")\n\n\\begin{table}\n\\centering\n\\begin{talltblr}[ %% tabularray outer open\nentry=none,label=none,\nnote{*}={Hello World!},\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl\\textsuperscript{*} & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21.0 & 6\\textsuperscript{*} & 160 & 110 & 3.90 \\\\\n21.0 & 6 & 160 & 110 & 3.90 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{talltblr}\n\\end{table} \n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits=2)\n\n \n\n \n \n \n tinytable_y6eoobhlg2py7lo9cxn0\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -956,7 +956,7 @@ "href": "man/tt.html#draw-a-tiny-table", "title": "tinytable", "section": "", - "text": "The tt function renders a table in different formats with various styling options: HTML, Markdown, LaTeX, Word, PDF, PNG, or Typst. The table can be customized with additional functions:\n\n\nstyle_tt(): style fonts, colors, alignment, etc.\n\n\nformat_tt(): format numbers, dates, strings, etc.\n\n\ngroup_tt(): row or column group labels.\n\n\ntheme_tt(): apply a collection of transformations to a tinytable.\n\n\nsave_tt(): save the table to a file or return the table as a string.\n\n\nprint(): print to a specific format, ex: print(x, “latex”)\n\n\ntinytable attempts to determine the appropriate way to print the table based on interactive use, RStudio availability, and output format in RMarkdown or Quarto documents. Users can call print(x, output=“markdown”) to print the table in a specific format. Alternatively, they can set a global option: options(“tinytable_print_output”=“markdown”)\n\n\n\ntt(\n x,\n digits = getOption(\"tinytable_tt_digits\", default = NULL),\n caption = NULL,\n notes = NULL,\n width = getOption(\"tinytable_tt_width\", default = NULL),\n theme = getOption(\"tinytable_tt_theme\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ndigits\n\n\nNumber of significant digits to keep for numeric variables. When digits is an integer, tt() calls format_tt(x, digits = digits) before proceeding to draw the table. Note that this will apply all default argument values of format_tt(), such as replacing NA by \"\". Users who need more control can use the format_tt() function instead.\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table. This argument should not be used in Quarto or Rmarkdown documents. In that context, please use the appropriate chunk options.\n\n\n\n\nnotes\n\n\nNotes to append to the bottom of the table. This argument accepts several different inputs:\n\n\nSingle string insert a single note: “blah blah”\n\n\nMultiple strings insert multiple notes sequentially: list(“Hello world”, “Foo bar”)\n\n\nA named list inserts a list with the name as superscript: list(“a” = list(“Hello World”))\n\n\nA named list with positions inserts markers as superscripts inside table cells: list(“a” = list(i = 0:1, j = 2, text = “Hello World”))\n\n\n\n\n\n\nwidth\n\n\nTable or column width.\n\n\nSingle numeric value smaller than or equal to 1 determines the full table width, in proportion of line width.\n\n\nNumeric vector of length equal to the number of columns in x determines the width of each column, in proportion of line width. If the sum of width exceeds 1, each element is divided by sum(width). This makes the table full-width with relative column sizes.\n\n\n\n\n\n\ntheme\n\n\nFunction or string.\n\n\nString: grid, resize, multipage, placement, striped, void, bootstrap, tabular\n\n\nFunction: Applied to the tinytable object.\n\n\n\n\n\n\n…\n\n\nAdditional arguments are ignored\n\n\n\n\n\n\nAn object of class tt representing the table.\nThe table object has S4 slots which hold information about the structure of the table. This meta-data can be accessed with the usual @ accessor. In general, modifying the content of these slots is not recommended, but it can be useful to some developers, such as those who want to force print to a specific output format without calling print().\n\n\n\nWhen rendering Quarto and Rmarkdown documents, tinytable will populate the LaTeX preamble automatically with all the required packages. For standalone LaTeX packages, these commands should be inserted in the preamble:\n\n\\usepackage{tabularray}\n\\usepackage{float}\n\\usepackage{graphicx}\n\\usepackage[normalem]{ulem}\n\\UseTblrLibrary{booktabs}\n\\newcommand{\\tinytableTabularrayUnderline}[1]{\\underline{#1}}\n\\newcommand{\\tinytableTabularrayStrikeout}[1]{\\sout{#1}}\n\\NewTableCommand{\\tinytableDefineColor}[3]{\\definecolor{#1}{#2}{#3}}\n\n\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_87jhu0hvppld9788btf5\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_bo5mixdsxheh8ytmoxb4\n \n \n \n \n \n\n \n \n \n \n Data about cars.\n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x, notes = \"Hello World!\")\n\n \n\n \n \n \n tinytable_y0erq79z5slgp5591j9m\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n Hello World!\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\nfn <- list(i = 0:1, j = 2, text = \"Hello World!\")\ntab <- tt(x, notes = list(\"*\" = fn))\nprint(tab, \"latex\")\n\n\\begin{table}\n\\centering\n\\begin{talltblr}[ %% tabularray outer open\nentry=none,label=none,\nnote{*}={Hello World!},\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl\\textsuperscript{*} & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21.0 & 6\\textsuperscript{*} & 160 & 110 & 3.90 \\\\\n21.0 & 6 & 160 & 110 & 3.90 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{talltblr}\n\\end{table} \n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits=2)\n\n \n\n \n \n \n tinytable_ngwdoogofelcuszf0tic\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568", + "text": "The tt function renders a table in different formats with various styling options: HTML, Markdown, LaTeX, Word, PDF, PNG, or Typst. The table can be customized with additional functions:\n\n\nstyle_tt(): style fonts, colors, alignment, etc.\n\n\nformat_tt(): format numbers, dates, strings, etc.\n\n\ngroup_tt(): row or column group labels.\n\n\ntheme_tt(): apply a collection of transformations to a tinytable.\n\n\nsave_tt(): save the table to a file or return the table as a string.\n\n\nprint(): print to a specific format, ex: print(x, “latex”)\n\n\ntinytable attempts to determine the appropriate way to print the table based on interactive use, RStudio availability, and output format in RMarkdown or Quarto documents. Users can call print(x, output=“markdown”) to print the table in a specific format. Alternatively, they can set a global option: options(“tinytable_print_output”=“markdown”)\n\n\n\ntt(\n x,\n digits = getOption(\"tinytable_tt_digits\", default = NULL),\n caption = NULL,\n notes = NULL,\n width = getOption(\"tinytable_tt_width\", default = NULL),\n theme = getOption(\"tinytable_tt_theme\", default = NULL),\n ...\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or data table to be rendered as a table.\n\n\n\n\ndigits\n\n\nNumber of significant digits to keep for numeric variables. When digits is an integer, tt() calls format_tt(x, digits = digits) before proceeding to draw the table. Note that this will apply all default argument values of format_tt(), such as replacing NA by \"\". Users who need more control can use the format_tt() function instead.\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table. This argument should not be used in Quarto or Rmarkdown documents. In that context, please use the appropriate chunk options.\n\n\n\n\nnotes\n\n\nNotes to append to the bottom of the table. This argument accepts several different inputs:\n\n\nSingle string insert a single note: “blah blah”\n\n\nMultiple strings insert multiple notes sequentially: list(“Hello world”, “Foo bar”)\n\n\nA named list inserts a list with the name as superscript: list(“a” = list(“Hello World”))\n\n\nA named list with positions inserts markers as superscripts inside table cells: list(“a” = list(i = 0:1, j = 2, text = “Hello World”))\n\n\n\n\n\n\nwidth\n\n\nTable or column width.\n\n\nSingle numeric value smaller than or equal to 1 determines the full table width, in proportion of line width.\n\n\nNumeric vector of length equal to the number of columns in x determines the width of each column, in proportion of line width. If the sum of width exceeds 1, each element is divided by sum(width). This makes the table full-width with relative column sizes.\n\n\n\n\n\n\ntheme\n\n\nFunction or string.\n\n\nString: grid, resize, multipage, placement, striped, void, bootstrap, tabular\n\n\nFunction: Applied to the tinytable object.\n\n\n\n\n\n\n…\n\n\nAdditional arguments are ignored\n\n\n\n\n\n\nAn object of class tt representing the table.\nThe table object has S4 slots which hold information about the structure of the table. This meta-data can be accessed with the usual @ accessor. In general, modifying the content of these slots is not recommended, but it can be useful to some developers, such as those who want to force print to a specific output format without calling print().\n\n\n\nWhen rendering Quarto and Rmarkdown documents, tinytable will populate the LaTeX preamble automatically with all the required packages. For standalone LaTeX packages, these commands should be inserted in the preamble:\n\n\\usepackage{tabularray}\n\\usepackage{float}\n\\usepackage{graphicx}\n\\usepackage[normalem]{ulem}\n\\UseTblrLibrary{booktabs}\n\\newcommand{\\tinytableTabularrayUnderline}[1]{\\underline{#1}}\n\\newcommand{\\tinytableTabularrayStrikeout}[1]{\\sout{#1}}\n\\NewTableCommand{\\tinytableDefineColor}[3]{\\definecolor{#1}{#2}{#3}}\n\n\n\n\n\n\noptions(tinytable_quarto_disable_processing = TRUE)\nDisable Quarto processing of cell content. Setting this global option to FALSE may lead to conflicts with some tinytable features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references.\n\nx <- data.frame(Math = \"x^2^\", Citation = \"@Lovelace1842\")\nfn <- function(z) sprintf(\"<span data-qmd='%s'></span>\", z)\ntt(x) |> format_tt(i = 1, fn = fn)\n\n\nSee this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_hc59npqb4vegpqmpve85\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_eiwoduhsfqvzpugkpf2g\n \n \n \n \n \n\n \n \n \n \n Data about cars.\n \n mpg\n cyl\n disp\n hp\n drat\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\ntt(x, notes = \"Hello World!\")\n\n \n\n \n \n \n tinytable_boyj9jmokttwxkbxrnbn\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n drat\n \n \n Hello World!\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 21.0\n 6\n 160\n 110\n 3.90\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n \n \n \n \n\n \n\n \n\n\n\nfn <- list(i = 0:1, j = 2, text = \"Hello World!\")\ntab <- tt(x, notes = list(\"*\" = fn))\nprint(tab, \"latex\")\n\n\\begin{table}\n\\centering\n\\begin{talltblr}[ %% tabularray outer open\nentry=none,label=none,\nnote{*}={Hello World!},\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl\\textsuperscript{*} & disp & hp & drat \\\\ \\midrule %% TinyTableHeader\n21.0 & 6\\textsuperscript{*} & 160 & 110 & 3.90 \\\\\n21.0 & 6 & 160 & 110 & 3.90 \\\\\n22.8 & 4 & 108 & 93 & 3.85 \\\\\n21.4 & 6 & 258 & 110 & 3.08 \\\\\n\\bottomrule\n\\end{talltblr}\n\\end{table} \n\nk <- data.frame(x = c(0.000123456789, 12.4356789))\ntt(k, digits=2)\n\n \n\n \n \n \n tinytable_y6eoobhlg2py7lo9cxn0\n \n \n \n \n \n\n \n \n \n \n \n \n x\n \n \n \n \n \n 0.00012\n \n \n 12.43568", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -992,7 +992,7 @@ "href": "man/theme_tt.html", "title": "tinytable", "section": "", - "text": "A theme is a function which applies a collection of transformations to a tinytable object. Whereas the other tinytable functions such as format_tt() and style_tt() aim to be output-agnostic, themes can be output-specific, only applying to LaTeX, HTML, or Typst, as needed.\nEach theme can have specific arguments, which are passed to the theme_tt() function. See the \"Arguments\" section below.\n\n\n\ntheme_tt(x, theme, ...)\n\n\n\n\n\n\n\nx\n\n\nA tinytable object\n\n\n\n\ntheme\n\n\nString. Name of the theme to apply. One of:\n\n\n\"grid\": Vertical and horizontal rules around each cell.\n\n\n\"void\": No rules\n\n\n\"bootstrap\": Similar appearance to the default Bootstrap theme in HTML\n\n\n\"striped\": Grey stripes on alternating rows\n\n\n\"tabular\": No table environment (LaTeX) or Javascript/CSS (HTML)\n\n\n\"resize\": Scale a LaTeX tinytable to fit the width argument.\n\n\n\"multipage\": Long tables continue on the next page (LaTeX only)\n\n\n\"placement\": Position of the table environment (LaTeX)\n\n\n\n\n\n\n…\n\n\nAdditional arguments passed the themeing function. See the \"Arguments\" section below for a list of supported arguments for each theme.\n\n\n\n\n\n\nA modified tinytable object\n\n\n\nresize\n\n\nwidth: A numeric value between 0.01 and 1, representing the proportion of the line width to use\n\n\ndirection: \"down\", \"up\", \"both\" A string indicating if the table should be scaled in one direction. For example, \"down\" will only resize the table if it exceeds \n\n\nmultipage\n\n\nrowhead: Non-negative integer. The number of header rows to repeat on each page.\n\n\nrowfoot: Non-negative integer. The number of footer rows to repeat on each page.\n\n\nplacement\n\n\nlatex_float: String to insert in square brackets after the LaTeX table environment, ex: \"H\", \"htbp\". The default value is controlled by a global option:\n\n\noptions(“tinytable_theme_placement_latex_float” = “H”)\n\n\n\n\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\n\nx <- mtcars[1:4, 1:4]\n\n# equivalent calls\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_9mkw5vuibthqgxxgz13b\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_4taikxlm2nuzausoesk0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n# resize w/ argument\nx <- cbind(mtcars[1:10,], mtcars[1:10,])\ntt(x) |>\n theme_tt(\"resize\", width = .9) |>\n print(\"latex\")\n\n\\begin{table}\n\\centering\n\\resizebox{\\ifdim\\width>\\linewidth 0.9\\linewidth\\else\\width\\fi}{!}{\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb & mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb \\\\ \\midrule %% TinyTableHeader\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 \\\\\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 \\\\\n22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 & 22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 \\\\\n21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 & 21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 \\\\\n18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 & 18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 \\\\\n18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 & 18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 \\\\\n14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 & 14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 \\\\\n24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 & 24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 \\\\\n22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 & 22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 \\\\\n19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 & 19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 \\\\\n\\bottomrule\n\\end{tblr}\n}\n\\end{table}", + "text": "A theme is a function which applies a collection of transformations to a tinytable object. Whereas the other tinytable functions such as format_tt() and style_tt() aim to be output-agnostic, themes can be output-specific, only applying to LaTeX, HTML, or Typst, as needed.\nEach theme can have specific arguments, which are passed to the theme_tt() function. See the \"Arguments\" section below.\n\n\n\ntheme_tt(x, theme, ...)\n\n\n\n\n\n\n\nx\n\n\nA tinytable object\n\n\n\n\ntheme\n\n\nString. Name of the theme to apply. One of:\n\n\n\"grid\": Vertical and horizontal rules around each cell.\n\n\n\"void\": No rules\n\n\n\"bootstrap\": Similar appearance to the default Bootstrap theme in HTML\n\n\n\"striped\": Grey stripes on alternating rows\n\n\n\"tabular\": No table environment (LaTeX) or Javascript/CSS (HTML)\n\n\n\"resize\": Scale a LaTeX tinytable to fit the width argument.\n\n\n\"multipage\": Long tables continue on the next page (LaTeX only)\n\n\n\"placement\": Position of the table environment (LaTeX)\n\n\n\n\n\n\n…\n\n\nAdditional arguments passed the themeing function. See the \"Arguments\" section below for a list of supported arguments for each theme.\n\n\n\n\n\n\nA modified tinytable object\n\n\n\nresize\n\n\nwidth: A numeric value between 0.01 and 1, representing the proportion of the line width to use\n\n\ndirection: \"down\", \"up\", \"both\" A string indicating if the table should be scaled in one direction. For example, \"down\" will only resize the table if it exceeds \n\n\nmultipage\n\n\nrowhead: Non-negative integer. The number of header rows to repeat on each page.\n\n\nrowfoot: Non-negative integer. The number of footer rows to repeat on each page.\n\n\nplacement\n\n\nlatex_float: String to insert in square brackets after the LaTeX table environment, ex: \"H\", \"htbp\". The default value is controlled by a global option:\n\n\noptions(“tinytable_theme_placement_latex_float” = “H”)\n\n\n\n\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\n\nx <- mtcars[1:4, 1:4]\n\n# equivalent calls\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_2l25bosu8ms8wz1vsw37\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_32qlsfehq7kjnge7h7l1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n# resize w/ argument\nx <- cbind(mtcars[1:10,], mtcars[1:10,])\ntt(x) |>\n theme_tt(\"resize\", width = .9) |>\n print(\"latex\")\n\n\\begin{table}\n\\centering\n\\resizebox{\\ifdim\\width>\\linewidth 0.9\\linewidth\\else\\width\\fi}{!}{\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb & mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb \\\\ \\midrule %% TinyTableHeader\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 \\\\\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 \\\\\n22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 & 22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 \\\\\n21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 & 21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 \\\\\n18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 & 18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 \\\\\n18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 & 18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 \\\\\n14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 & 14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 \\\\\n24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 & 24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 \\\\\n22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 & 22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 \\\\\n19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 & 19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 \\\\\n\\bottomrule\n\\end{tblr}\n}\n\\end{table}", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -1004,7 +1004,7 @@ "href": "man/theme_tt.html#themes-for-tinytable", "title": "tinytable", "section": "", - "text": "A theme is a function which applies a collection of transformations to a tinytable object. Whereas the other tinytable functions such as format_tt() and style_tt() aim to be output-agnostic, themes can be output-specific, only applying to LaTeX, HTML, or Typst, as needed.\nEach theme can have specific arguments, which are passed to the theme_tt() function. See the \"Arguments\" section below.\n\n\n\ntheme_tt(x, theme, ...)\n\n\n\n\n\n\n\nx\n\n\nA tinytable object\n\n\n\n\ntheme\n\n\nString. Name of the theme to apply. One of:\n\n\n\"grid\": Vertical and horizontal rules around each cell.\n\n\n\"void\": No rules\n\n\n\"bootstrap\": Similar appearance to the default Bootstrap theme in HTML\n\n\n\"striped\": Grey stripes on alternating rows\n\n\n\"tabular\": No table environment (LaTeX) or Javascript/CSS (HTML)\n\n\n\"resize\": Scale a LaTeX tinytable to fit the width argument.\n\n\n\"multipage\": Long tables continue on the next page (LaTeX only)\n\n\n\"placement\": Position of the table environment (LaTeX)\n\n\n\n\n\n\n…\n\n\nAdditional arguments passed the themeing function. See the \"Arguments\" section below for a list of supported arguments for each theme.\n\n\n\n\n\n\nA modified tinytable object\n\n\n\nresize\n\n\nwidth: A numeric value between 0.01 and 1, representing the proportion of the line width to use\n\n\ndirection: \"down\", \"up\", \"both\" A string indicating if the table should be scaled in one direction. For example, \"down\" will only resize the table if it exceeds \n\n\nmultipage\n\n\nrowhead: Non-negative integer. The number of header rows to repeat on each page.\n\n\nrowfoot: Non-negative integer. The number of footer rows to repeat on each page.\n\n\nplacement\n\n\nlatex_float: String to insert in square brackets after the LaTeX table environment, ex: \"H\", \"htbp\". The default value is controlled by a global option:\n\n\noptions(“tinytable_theme_placement_latex_float” = “H”)\n\n\n\n\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\n\nx <- mtcars[1:4, 1:4]\n\n# equivalent calls\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_9mkw5vuibthqgxxgz13b\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_4taikxlm2nuzausoesk0\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n# resize w/ argument\nx <- cbind(mtcars[1:10,], mtcars[1:10,])\ntt(x) |>\n theme_tt(\"resize\", width = .9) |>\n print(\"latex\")\n\n\\begin{table}\n\\centering\n\\resizebox{\\ifdim\\width>\\linewidth 0.9\\linewidth\\else\\width\\fi}{!}{\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb & mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb \\\\ \\midrule %% TinyTableHeader\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 \\\\\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 \\\\\n22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 & 22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 \\\\\n21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 & 21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 \\\\\n18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 & 18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 \\\\\n18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 & 18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 \\\\\n14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 & 14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 \\\\\n24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 & 24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 \\\\\n22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 & 22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 \\\\\n19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 & 19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 \\\\\n\\bottomrule\n\\end{tblr}\n}\n\\end{table}", + "text": "A theme is a function which applies a collection of transformations to a tinytable object. Whereas the other tinytable functions such as format_tt() and style_tt() aim to be output-agnostic, themes can be output-specific, only applying to LaTeX, HTML, or Typst, as needed.\nEach theme can have specific arguments, which are passed to the theme_tt() function. See the \"Arguments\" section below.\n\n\n\ntheme_tt(x, theme, ...)\n\n\n\n\n\n\n\nx\n\n\nA tinytable object\n\n\n\n\ntheme\n\n\nString. Name of the theme to apply. One of:\n\n\n\"grid\": Vertical and horizontal rules around each cell.\n\n\n\"void\": No rules\n\n\n\"bootstrap\": Similar appearance to the default Bootstrap theme in HTML\n\n\n\"striped\": Grey stripes on alternating rows\n\n\n\"tabular\": No table environment (LaTeX) or Javascript/CSS (HTML)\n\n\n\"resize\": Scale a LaTeX tinytable to fit the width argument.\n\n\n\"multipage\": Long tables continue on the next page (LaTeX only)\n\n\n\"placement\": Position of the table environment (LaTeX)\n\n\n\n\n\n\n…\n\n\nAdditional arguments passed the themeing function. See the \"Arguments\" section below for a list of supported arguments for each theme.\n\n\n\n\n\n\nA modified tinytable object\n\n\n\nresize\n\n\nwidth: A numeric value between 0.01 and 1, representing the proportion of the line width to use\n\n\ndirection: \"down\", \"up\", \"both\" A string indicating if the table should be scaled in one direction. For example, \"down\" will only resize the table if it exceeds \n\n\nmultipage\n\n\nrowhead: Non-negative integer. The number of header rows to repeat on each page.\n\n\nrowfoot: Non-negative integer. The number of footer rows to repeat on each page.\n\n\nplacement\n\n\nlatex_float: String to insert in square brackets after the LaTeX table environment, ex: \"H\", \"htbp\". The default value is controlled by a global option:\n\n\noptions(“tinytable_theme_placement_latex_float” = “H”)\n\n\n\n\n\n\n\n\nlibrary(tinytable)\n\nlibrary(tinytable)\n\nx <- mtcars[1:4, 1:4]\n\n# equivalent calls\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_2l25bosu8ms8wz1vsw37\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\ntt(x) |> theme_tt(\"striped\")\n\n \n\n \n \n \n tinytable_32qlsfehq7kjnge7h7l1\n \n \n \n \n \n\n \n \n \n \n \n \n mpg\n cyl\n disp\n hp\n \n \n \n \n \n 21.0\n 6\n 160\n 110\n \n \n 21.0\n 6\n 160\n 110\n \n \n 22.8\n 4\n 108\n 93\n \n \n 21.4\n 6\n 258\n 110\n \n \n \n \n\n \n\n \n\n\n\n# resize w/ argument\nx <- cbind(mtcars[1:10,], mtcars[1:10,])\ntt(x) |>\n theme_tt(\"resize\", width = .9) |>\n print(\"latex\")\n\n\\begin{table}\n\\centering\n\\resizebox{\\ifdim\\width>\\linewidth 0.9\\linewidth\\else\\width\\fi}{!}{\n\\begin{tblr}[ %% tabularray outer open\n] %% tabularray outer close\n{ %% tabularray inner open\ncolspec={Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]Q[]},\n} %% tabularray inner close\n\\toprule\nmpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb & mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb \\\\ \\midrule %% TinyTableHeader\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4 \\\\\n21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 & 21.0 & 6 & 160.0 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4 \\\\\n22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 & 22.8 & 4 & 108.0 & 93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1 \\\\\n21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 & 21.4 & 6 & 258.0 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1 \\\\\n18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 & 18.7 & 8 & 360.0 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2 \\\\\n18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 & 18.1 & 6 & 225.0 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1 \\\\\n14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 & 14.3 & 8 & 360.0 & 245 & 3.21 & 3.570 & 15.84 & 0 & 0 & 3 & 4 \\\\\n24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 & 24.4 & 4 & 146.7 & 62 & 3.69 & 3.190 & 20.00 & 1 & 0 & 4 & 2 \\\\\n22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 & 22.8 & 4 & 140.8 & 95 & 3.92 & 3.150 & 22.90 & 1 & 0 & 4 & 2 \\\\\n19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 & 19.2 & 6 & 167.6 & 123 & 3.92 & 3.440 & 18.30 & 1 & 0 & 4 & 4 \\\\\n\\bottomrule\n\\end{tblr}\n}\n\\end{table}", "crumbs": [ "Tutorial (PDF)", "Functions", @@ -1016,7 +1016,7 @@ "href": "CITATION.html", "title": "Citation", "section": "", - "text": "Citation\nTo cite package ‘tinytable’ in publications use:\n\n Arel-Bundock V (????). _tinytable: Simple and Configurable Tables in\n 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst'\n Formats_. R package version 0.2.1.14,\n <https://vincentarelbundock.github.io/tinytable/>.\n\nA BibTeX entry for LaTeX users is\n\n @Manual{,\n title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats},\n author = {Vincent Arel-Bundock},\n note = {R package version 0.2.1.14},\n url = {https://vincentarelbundock.github.io/tinytable/},\n }", + "text": "Citation\nTo cite package ‘tinytable’ in publications use:\n\n Arel-Bundock V (????). _tinytable: Simple and Configurable Tables in\n 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst'\n Formats_. R package version 0.2.1.15,\n <https://vincentarelbundock.github.io/tinytable/>.\n\nA BibTeX entry for LaTeX users is\n\n @Manual{,\n title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats},\n author = {Vincent Arel-Bundock},\n note = {R package version 0.2.1.15},\n url = {https://vincentarelbundock.github.io/tinytable/},\n }", "crumbs": [ "Tutorial (PDF)", "Citation" diff --git a/vignettes/custom.html b/vignettes/custom.html index a1cec729..499d6f82 100644 --- a/vignettes/custom.html +++ b/vignettes/custom.html @@ -414,9 +414,9 @@

Bootstrap classes

- tinytable_qey0bwzdlwcm29htppm1 + tinytable_mbz252apmi2qj6x4suy2 @@ -434,7 +434,7 @@

Bootstrap classes

-
+
@@ -480,12 +480,12 @@

Bootstrap classes

@@ -543,9 +543,9 @@

Bootstrap classes

- tinytable_ancqtjftnbrkr9n14cfy + tinytable_pt1baxj90y7h94kxmsxh @@ -563,7 +563,7 @@

Bootstrap classes

-
+
@@ -609,12 +609,12 @@

Bootstrap classes

@@ -675,10 +675,10 @@

CSS declarations

- tinytable_ota7y6lpc864yp13okh4 + tinytable_nlq3wzxoly1c9g80xou9 @@ -696,7 +696,7 @@

CSS declarations

-
+
@@ -742,12 +742,12 @@

CSS declarations

@@ -849,10 +849,10 @@

CSS rules

- tinytable_qhhag2dh0uus725wyb1b + tinytable_p7tchtvqrfp7xdd97fdx @@ -452,7 +452,7 @@

Numbers, dates,
-

+
@@ -467,19 +467,19 @@

Numbers, dates,

- + - + - + @@ -487,12 +487,12 @@

Numbers, dates, @@ -558,9 +558,9 @@

Numbers, dates, - tinytable_kppfum0vfdcgovspi5gq + tinytable_oa44uzcgfxkwkfjdyt3h @@ -578,7 +578,7 @@

Numbers, dates,
-

143002 1.431970-06-081971-05-25 True
201399 201.4 1970-06-031972-06-02 True
100188 0.131970-06-191970-10-13 False
+
@@ -593,19 +593,19 @@

Numbers, dates,

- + - + - + @@ -613,12 +613,12 @@

Numbers, dates, @@ -681,9 +681,9 @@

Numbers, dates, - tinytable_hg5j352ctx2bz486vprd + tinytable_v36w9pwcadojo4czjyku @@ -701,7 +701,7 @@

Numbers, dates,
-

143 002,21 1.4June 08 1970May 25 1971 True
201 399,18 201.4June 03 1970June 02 1972 True
100 188,39 0.1June 19 1970October 13 1970 False
+
@@ -737,12 +737,12 @@

Numbers, dates, @@ -816,9 +816,9 @@

Significan - tinytable_ww1fznmnu132vz6e196t + tinytable_vls2tzmtlv0f0kbgr4yt @@ -836,7 +836,7 @@

Significan
-

+
@@ -856,12 +856,12 @@

Significan @@ -914,9 +914,9 @@

Significan - tinytable_wjce5tkw8zf41qh1d42v + tinytable_k14z57d7g2n4istgg2eg @@ -934,7 +934,7 @@

Significan
-

+
@@ -954,12 +954,12 @@

Significan @@ -1014,9 +1014,9 @@

Significan - tinytable_5893179da5gmdjel0ybd + tinytable_j43u4ln7a43jdtol4fof @@ -1034,7 +1034,7 @@

Significan
-

+
@@ -1054,12 +1054,12 @@

Significan @@ -1117,9 +1117,9 @@

Replacement

- tinytable_6b9l79dm0bcko7ytlp94 + tinytable_aiiw0my7qdy5fuj550st @@ -1137,7 +1137,7 @@

Replacement

-
+
@@ -1164,12 +1164,12 @@

Replacement

@@ -1220,9 +1220,9 @@

Replacement

- tinytable_6iqqt6mk20b29jfqxzub + tinytable_t1ilnss3dvkaqnugtna2 @@ -1240,7 +1240,7 @@

Replacement

-
+
@@ -1267,12 +1267,12 @@

Replacement

@@ -1323,9 +1323,9 @@

Replacement

- tinytable_y65rtpywmzgv1qz9fupm + tinytable_y6zqwbtdc0iniiyx9bvx @@ -1343,7 +1343,7 @@

Replacement

-
+
@@ -1370,12 +1370,12 @@

Replacement

@@ -1431,9 +1431,9 @@

Replacement

- tinytable_s7yrhfkgsbwu3xh7ln2c + tinytable_1rnyit5zco5jiovumvz8 @@ -1451,7 +1451,7 @@

Replacement

-
+
@@ -1486,12 +1486,12 @@

Replacement

@@ -1553,9 +1553,9 @@

Escape special c - tinytable_3schrkdnz46tw4asyzey + tinytable_kv44qr4xgq2yx1xufkgu @@ -1573,7 +1573,7 @@

Escape special c
-

+
@@ -1600,12 +1600,12 @@

Escape special c @@ -1676,10 +1676,10 @@

Markdown

- tinytable_bybi75z41qdzqg95watd + tinytable_yovyblxolxl539n8uvn1 @@ -1697,7 +1697,7 @@

Markdown

-
+
@@ -1717,12 +1717,12 @@

Markdown

@@ -1808,9 +1808,9 @@

Markdown

- tinytable_k984dcvk53pe12ocpuik + tinytable_nhw5lo3wyuxde5cabftd @@ -1828,7 +1828,7 @@

Markdown

-
+

Vincent sometimes contributes to these R packages.

@@ -1887,12 +1887,12 @@

Markdown

@@ -1951,9 +1951,9 @@

Custom functions

- tinytable_gykrl062tpkhsi8jo5uq + tinytable_silq74avnb6va0sucsf3 @@ -1971,7 +1971,7 @@

Custom functions

-

Vincent sometimes contributes to these R packages.

+
@@ -2017,12 +2017,12 @@

Custom functions

@@ -2094,9 +2094,9 @@

Custom functions

- tinytable_fntht2ix1fgr34r9px06 + tinytable_3kuouuerzo2ch3qj9q6j @@ -2114,7 +2114,7 @@

Custom functions

-
+
@@ -2160,12 +2160,12 @@

Custom functions

@@ -2229,9 +2229,9 @@

Quarto data process - tinytable_ev6fb5hp08hfa2rjvvx6 + tinytable_1stc1657mskghbxeoctl @@ -2250,7 +2250,7 @@

Quarto data process
-

+
@@ -2268,12 +2268,12 @@

Quarto data process @@ -2332,9 +2332,9 @@

Quarto data process - tinytable_y5xcn8b8g5tkskdyzv73 + tinytable_bsrx6lzsyl6efxf35xx0 @@ -2353,7 +2353,7 @@

Quarto data process
-

Thing
+
@@ -2371,12 +2371,12 @@

Quarto data process @@ -2438,9 +2438,9 @@

Quarto data process - tinytable_m001jxqkiz9gtkkiynq0 + tinytable_zw9dj20cqv2u15qnm5mj @@ -2459,7 +2459,7 @@

Quarto data process
-

Thing
+
@@ -2504,12 +2504,12 @@

Quarto data process diff --git a/vignettes/group.html b/vignettes/group.html index 1a41d602..191822af 100644 --- a/vignettes/group.html +++ b/vignettes/group.html @@ -407,11 +407,11 @@

Rows

- tinytable_14t7fpfwoigo6niumz5m + tinytable_l7gd65v3j44u9u81q7mg @@ -429,7 +429,7 @@

Rows

-
mpg
+
@@ -540,12 +540,12 @@

Rows

@@ -636,12 +636,12 @@

Rows

- tinytable_dretfkz87899pydo5luk + tinytable_v2yzwfbdz74zzgus65n5 @@ -659,7 +659,7 @@

Rows

-
+
@@ -770,12 +770,12 @@

Rows

@@ -887,11 +887,11 @@

Columns

- tinytable_w5uuoew91upeh4mp2h82 + tinytable_663jeggk9vdwsxa4d8mm @@ -909,7 +909,7 @@

Columns

-
+
@@ -1027,12 +1027,12 @@

Columns

@@ -1117,15 +1117,15 @@

Columns

- tinytable_2a0kwnxeoauk7oevrvq9 + tinytable_wtr50wgr478cw5368dia @@ -1143,7 +1143,7 @@

Columns

-
Hamburgers
+
@@ -1261,12 +1261,12 @@

Columns

@@ -1391,13 +1391,13 @@

Columns

- tinytable_zp9ex7y7goab99kryn6j + tinytable_gjzgtrqqcaj4pb69lcs4 @@ -1415,7 +1415,7 @@

Columns

-
Hamburgers
+
@@ -1472,12 +1472,12 @@

Columns

diff --git a/vignettes/plot.html b/vignettes/plot.html index 0c58a014..d584fc2c 100644 --- a/vignettes/plot.html +++ b/vignettes/plot.html @@ -418,9 +418,9 @@

Inserting image - tinytable_va035ttx2715evru9a1u + tinytable_eljwmp9fn522wllp9e0u @@ -438,7 +438,7 @@

Inserting image
-

Hello
+
@@ -461,12 +461,12 @@

Inserting image @@ -524,10 +524,10 @@

Inserting image - tinytable_e931k0fbocnxch53045u + tinytable_hxouydii56944jdt0z32 @@ -545,7 +545,7 @@

Inserting image
-

+
@@ -562,12 +562,12 @@

Inserting image @@ -652,10 +652,10 @@

Built-in plots

- tinytable_xbdwib94rf8koqoekm23 + tinytable_8apahn2sq8lk2gs4m7ig @@ -673,7 +673,7 @@

Built-in plots

-
+
@@ -688,36 +688,36 @@

Built-in plots

- - - - + + + + - - - - + + + + - - - - + + + +
mpg
hp
qsec
@@ -804,9 +804,9 @@

Custom plots: Base - tinytable_ita7kfe0gu3uuyvguomw + tinytable_tp8l38jlk6m4riv40151 @@ -824,7 +824,7 @@

Custom plots: Base - +
@@ -836,27 +836,27 @@

Custom plots: Base

- + - + - +
mpg
hp
qsec
@@ -928,9 +928,9 @@

Custom plots: g - tinytable_iqfnqg5qby0iho6mgdos + tinytable_rc9l8680yz12idlkrks4 @@ -948,7 +948,7 @@

Custom plots: g
- +
@@ -960,27 +960,27 @@

Custom plots: g

- + - + - +
mpg
hp
qsec
@@ -1068,10 +1068,10 @@

Custom plots: g - tinytable_7hjdscf2wfs0e7n515vm + tinytable_yjab7h6j6q1zr3l9se80 @@ -1089,7 +1089,7 @@

Custom plots: g
- +
@@ -1103,33 +1103,33 @@

Custom plots: g

- - - + + + - - - + + + - - - + + +
Adelie
Chinstrap
Gentoo
@@ -1204,9 +1204,9 @@

Fontawesome

- tinytable_e8bqdll88mnrty72bg6x + tinytable_kkor365kddq4y2n1qybn @@ -1224,7 +1224,7 @@

Fontawesome

- +
@@ -1265,12 +1265,12 @@

Fontawesome

diff --git a/vignettes/style.html b/vignettes/style.html index c9cd4825..4b8ab07a 100644 --- a/vignettes/style.html +++ b/vignettes/style.html @@ -436,10 +436,10 @@

Cells, rows, columns - tinytable_jlt78kr33h5ekdtduj8l + tinytable_hv98tbfahnbfbvlv3kto @@ -457,7 +457,7 @@

Cells, rows, columns -

+
@@ -503,12 +503,12 @@

Cells, rows, columns @@ -571,10 +571,10 @@

Cells, rows, columns - tinytable_ca9t8ow9isdsow1zjjpg + tinytable_iji3oxqla4m8cs9h1hd5 @@ -592,7 +592,7 @@

Cells, rows, columns -

+
@@ -638,12 +638,12 @@

Cells, rows, columns @@ -706,10 +706,10 @@

Cells, rows, columns - tinytable_achngqvzmeh63zepkv73 + tinytable_v61u9930p4dtsr2aeb1d @@ -727,7 +727,7 @@

Cells, rows, columns -

+
@@ -773,12 +773,12 @@

Cells, rows, columns @@ -855,10 +855,10 @@

Cells, rows, columns - tinytable_wz59x3z9t7k9rd2jpev0 + tinytable_1jyvic47jejq6ntwvto4 @@ -876,7 +876,7 @@

Cells, rows, columns -

+
@@ -922,12 +922,12 @@

Cells, rows, columns @@ -994,10 +994,10 @@

Cells, rows, columns - tinytable_68oqy0ojfruew0lgncia + tinytable_enlqppjgo191003nvai9 @@ -1015,7 +1015,7 @@

Cells, rows, columns -

+
@@ -1061,12 +1061,12 @@

Cells, rows, columns @@ -1133,10 +1133,10 @@

Cells, rows, columns - tinytable_pibjtubnt22llmwgla2g + tinytable_y3hgr6hwwiicwh857ihe @@ -1154,7 +1154,7 @@

Cells, rows, columns -

+
@@ -1200,12 +1200,12 @@

Cells, rows, columns @@ -1269,10 +1269,10 @@

Cells, rows, columns - tinytable_mkmtgm171sk0v3c7lj9x + tinytable_oock179i44ar3t4w6nrr @@ -1290,7 +1290,7 @@

Cells, rows, columns -

+
@@ -1336,12 +1336,12 @@

Cells, rows, columns @@ -1408,10 +1408,10 @@

Cells, rows, columns - tinytable_8jq7k1q7byictt2wx7jr + tinytable_xxo4mvnkwox0q8ti4b06 @@ -1429,7 +1429,7 @@

Cells, rows, columns -

+
@@ -1475,12 +1475,12 @@

Cells, rows, columns @@ -1554,11 +1554,11 @@

Cells, rows, columns - tinytable_zewad9lbj76p861w1ssj + tinytable_8v2yezuxapghyiqiqx66 @@ -1576,7 +1576,7 @@

Cells, rows, columns -

+
@@ -1622,12 +1622,12 @@

Cells, rows, columns @@ -1704,10 +1704,10 @@

Colors

- tinytable_j9go0k2l31logiq8fj4x + tinytable_quncb6fszzh3yl7gk1mz @@ -1725,7 +1725,7 @@

Colors

-
+
@@ -1771,12 +1771,12 @@

Colors

@@ -1846,10 +1846,10 @@

Alignment

- tinytable_g6n0fes6ivukqsj6ee8e + tinytable_sx18fokeiyo4uqjayjoq @@ -1867,7 +1867,7 @@

Alignment

-
+
@@ -1898,12 +1898,12 @@

Alignment

@@ -1967,12 +1967,12 @@

Alignment

- tinytable_pd8ttkracfu5cfj5qvpb + tinytable_0y4odto8lrmwrgk7gito @@ -1990,7 +1990,7 @@

Alignment

-
+
@@ -2021,12 +2021,12 @@

Alignment

@@ -2096,10 +2096,10 @@

Alignment

- tinytable_kebnu2ougblalhvl1mx9 + tinytable_l2s70tjyb008683uqwmn @@ -2117,7 +2117,7 @@

Alignment

-
+
@@ -2143,12 +2143,12 @@

Alignment

@@ -2209,10 +2209,10 @@

Font size

- tinytable_bi21zxzuxzylxko1f475 + tinytable_rw317bsl19vq6p32xgcg @@ -2230,7 +2230,7 @@

Font size

-
+
@@ -2276,12 +2276,12 @@

Font size

@@ -2359,10 +2359,10 @@

Spanning cell - tinytable_ee9higwjrqwy5x0atou2 + tinytable_opmraltq8tedel9o9xly @@ -2380,7 +2380,7 @@

Spanning cell
-

+
@@ -2426,12 +2426,12 @@

Spanning cell @@ -2490,9 +2490,9 @@

Spanning cell - tinytable_z7b01b6ivb4d05n2h4si + tinytable_s78hfmrb7t2ydlhacwf9 @@ -2510,7 +2510,7 @@

Spanning cell
-

+
@@ -2556,12 +2556,12 @@

Spanning cell @@ -2631,10 +2631,10 @@

Spanning cell - tinytable_3ne1csibkzw4bp4lbsja + tinytable_rvzbv3r3opz4aslp0ian @@ -2652,7 +2652,7 @@

Spanning cell
-

+
@@ -2698,12 +2698,12 @@

Spanning cell @@ -2769,9 +2769,9 @@

Headers

- tinytable_smdqgwepet2hi20f2mrf + tinytable_t60prwofjfcu9sb3fbuh @@ -2789,7 +2789,7 @@

Headers

-
+
@@ -2828,12 +2828,12 @@

Headers

@@ -2890,10 +2890,10 @@

Headers

- tinytable_gefye105as1ijzs41yg6 + tinytable_wij6vgpjpbt4robh0k6g @@ -2911,7 +2911,7 @@

Headers

-
+
@@ -2957,12 +2957,12 @@

Headers

@@ -3024,10 +3024,10 @@

Headers

- tinytable_xzclij2soizbf0b1byck + tinytable_kc94jt9uol842pzq4ofl @@ -3045,7 +3045,7 @@

Headers

-
+
@@ -3091,12 +3091,12 @@

Headers

@@ -3172,10 +3172,10 @@

Conditional styling - tinytable_596t8jextrfxrum5rth1 + tinytable_nhieafr3el6vhcsik62l @@ -3193,7 +3193,7 @@

Conditional styling -

+
@@ -3259,12 +3259,12 @@

Conditional styling @@ -3334,13 +3334,13 @@

Vectorized sty - tinytable_du27258hojwsnw12kio1 + tinytable_qh5g9qnj1yw6s4ium5qp @@ -3358,7 +3358,7 @@

Vectorized sty
-

+
@@ -3404,12 +3404,12 @@

Vectorized sty @@ -3490,11 +3490,11 @@

Vectorized sty - tinytable_rjvme3us7msc1c8evbot + tinytable_xhvbx8w5aesms5fkwkpq @@ -3512,7 +3512,7 @@

Vectorized sty
-

+
@@ -3558,12 +3558,12 @@

Vectorized sty @@ -3649,29 +3649,29 @@

Vectorized sty - tinytable_ckp69kdxozsi9cpkzqin + tinytable_6vbs668uhfwodimfjh9y @@ -3689,7 +3689,7 @@

Vectorized sty
-

+
@@ -3728,12 +3728,12 @@

Vectorized sty @@ -3847,9 +3847,9 @@

Lines (borders)

- tinytable_4bqf0c55h4tlapu7bo38 + tinytable_tt4odl2cqynnw3nen2o4 @@ -3867,7 +3867,7 @@

Lines (borders)

-
+
@@ -3913,12 +3913,12 @@

Lines (borders)

@@ -3985,11 +3985,11 @@

Lines (borders)

- tinytable_gxmat82efhww1e6j7v39 + tinytable_jg3e0bpx5nf33a98z6jf @@ -4007,7 +4007,7 @@

Lines (borders)

-
+
@@ -4053,12 +4053,12 @@

Lines (borders)

@@ -4130,9 +4130,9 @@

Lines (borders)

- tinytable_d77sgoudy1iok64hm21x + tinytable_yoc6f437690fa13zqtc0 @@ -4150,7 +4150,7 @@

Lines (borders)

-
+
@@ -4173,12 +4173,12 @@

Lines (borders)

@@ -4245,10 +4245,10 @@

Cell padding

- tinytable_62zlmplpdndn70d31j7u + tinytable_8pnlz89ftol3vgsuiv6k @@ -4266,7 +4266,7 @@

Cell padding

-
+
@@ -4312,12 +4312,12 @@

Cell padding

diff --git a/vignettes/theme.html b/vignettes/theme.html index 129a4976..73afadd5 100644 --- a/vignettes/theme.html +++ b/vignettes/theme.html @@ -406,7 +406,7 @@

Visual themes

- tinytable_g9aa9oaziqr4lc9rzyap + tinytable_6njngyv4awup8qlzwjhm @@ -425,7 +425,7 @@

Visual themes

-
+
@@ -471,12 +471,12 @@

Visual themes

@@ -545,7 +545,7 @@

Visual themes

-
+
@@ -591,12 +591,12 @@

Visual themes

@@ -652,7 +652,7 @@

Visual themes

- tinytable_3qlghwz3gmugwq7twge1 + tinytable_7ub2i207q5gdil1lxfls @@ -671,7 +671,7 @@

Visual themes

-
+
@@ -717,12 +717,12 @@

Visual themes

@@ -792,7 +792,7 @@

Visual themes

-
+
@@ -838,12 +838,12 @@

Visual themes

@@ -929,7 +929,7 @@

Custom themes

-
+
@@ -952,12 +952,12 @@

Custom themes

@@ -1012,10 +1012,10 @@

Custom themes

- tinytable_bkufwyz4joa9o2cao5cp + tinytable_neqilerqs8sw2g1qsuzn @@ -1033,7 +1033,7 @@

Custom themes

-
Always use the same caption.
+
@@ -1064,12 +1064,12 @@

Custom themes

diff --git a/vignettes/tinytable.html b/vignettes/tinytable.html index 1b387452..cba3b999 100644 --- a/vignettes/tinytable.html +++ b/vignettes/tinytable.html @@ -410,9 +410,9 @@

Tiny Tables

- tinytable_m3117y6rldfm847w57o4 + tinytable_f4y1syb95vqszir9axcg @@ -430,7 +430,7 @@

Tiny Tables

-
Always use the same caption.
+
@@ -476,12 +476,12 @@

Tiny Tables

@@ -540,9 +540,9 @@

Width

- tinytable_wf42pnnubfgmmb4u4p4h + tinytable_1zq0m1pws5ko61e6fx30 @@ -560,7 +560,7 @@

Width

-
+
@@ -606,12 +606,12 @@

Width

@@ -667,9 +667,9 @@

Width

- tinytable_kz6axqhxh8kxwezyzecc + tinytable_b7vn14rd7675honi0g5l @@ -687,7 +687,7 @@

Width

-
+
@@ -733,12 +733,12 @@

Width

@@ -795,14 +795,14 @@

Width

- tinytable_fk4o5lx9iai5hkawjg93 + tinytable_lvk8gxcluzb6bzt6ihha @@ -820,7 +820,7 @@

Width

-
+
@@ -866,12 +866,12 @@

Width

@@ -953,14 +953,14 @@

Width

- tinytable_s5puwk4q7nwbnr7k8avb + tinytable_eip64npgge4wm0r4czhp @@ -978,7 +978,7 @@

Width

-
+
@@ -1024,12 +1024,12 @@

Width

@@ -1116,9 +1116,9 @@

Width

- tinytable_xoyf73mi0785zdcf0i3r + tinytable_kt9yi7dmizkkh2mvkwry @@ -1136,7 +1136,7 @@

Width

-
+
@@ -1155,12 +1155,12 @@

Width

@@ -1219,9 +1219,9 @@

Footnotes

- tinytable_ztpvefvbeipyp4sdqpc2 + tinytable_l6sw7dyot3eqcb69k803 @@ -1239,7 +1239,7 @@

Footnotes

-
+

A full-width table with wrapped text in cells and a footnote.

@@ -1258,12 +1258,12 @@

Footnotes

@@ -1317,9 +1317,9 @@

Footnotes

- tinytable_qb4qx3hp1rg0d9vw9gxx + tinytable_ha046bgbtwi89mlsbee9 @@ -1337,7 +1337,7 @@

Footnotes

-

A full-width table with wrapped text in cells and a footnote.

+
@@ -1384,12 +1384,12 @@

Footnotes

@@ -1450,9 +1450,9 @@

Footnotes

- tinytable_6fyfut21ftmpev2mesp4 + tinytable_s12ak4tyt8ter0yf1p8s @@ -1470,7 +1470,7 @@

Footnotes

-
+
@@ -1517,12 +1517,12 @@

Footnotes

@@ -1599,9 +1599,9 @@

Captions and - tinytable_055r5to5c26453w2i9zl + tinytable_7hi2bd21j18k926of1md @@ -1619,7 +1619,7 @@

Captions and
-

+
@@ -1660,12 +1660,12 @@

Captions and @@ -1741,10 +1741,10 @@

Math

- tinytable_9w9uc2kb5v43oag5fd2u + tinytable_isaaf0vgzl5xh9gp701y @@ -1762,7 +1762,7 @@

Math

-
+
@@ -1782,12 +1782,12 @@

Math

@@ -1850,9 +1850,9 @@

Line breaks - tinytable_j3jztxkf1kkbjjlt9hpg + tinytable_htmwzuh5krh1lzrl0k3k @@ -1870,7 +1870,7 @@

Line breaks
-

+
@@ -1889,12 +1889,12 @@

Line breaks @@ -2027,9 +2027,9 @@

Combination an - tinytable_kyl9oty8yu72pyedx7kw + tinytable_qy7tj3t6ooi61o3bsvrv @@ -2047,7 +2047,7 @@

Combination an
-

+
@@ -2070,12 +2070,12 @@

Combination an @@ -2146,9 +2146,9 @@

Combination an - tinytable_otlukq6iuqveldxlci34 + tinytable_15sfy2ik91untrro80cw @@ -2166,7 +2166,7 @@

Combination an
-

+
@@ -2189,12 +2189,12 @@

Combination an @@ -2251,9 +2251,9 @@

Combination an - tinytable_au4f7f70jncfxa3zgv0b + tinytable_b13r59k353bxqr5y624n @@ -2271,7 +2271,7 @@

Combination an
-

+
@@ -2331,12 +2331,12 @@

Combination an @@ -2390,9 +2390,9 @@

Combination an - tinytable_vk0nuew5t50s7syj3i35 + tinytable_q1lqfpc81lzpzgxus9mv @@ -2410,7 +2410,7 @@

Combination an
-

Combine two tiny tables.
+
@@ -2470,12 +2470,12 @@

Combination an @@ -2533,9 +2533,9 @@

Combination an - tinytable_mowlpehl09d5kyedouom + tinytable_mhftw64g9ixqo50k1jtf @@ -2553,7 +2553,7 @@

Combination an
-

Combine two tiny tables.
+
@@ -2606,12 +2606,12 @@

Combination an @@ -2668,9 +2668,9 @@

Combination an - tinytable_p8y7ldghg19lbsif8fo3 + tinytable_zu2dmq0pc8fohcnpiaxk @@ -2688,7 +2688,7 @@

Combination an
-

Combine two tiny tables.
+
@@ -2734,12 +2734,12 @@

Combination an diff --git a/vignettes/tinytable_assets/id0g60v6b91uuynl1dupqi.png b/vignettes/tinytable_assets/id0g60v6b91uuynl1dupqi.png new file mode 100644 index 00000000..4e1ff0a7 Binary files /dev/null and b/vignettes/tinytable_assets/id0g60v6b91uuynl1dupqi.png differ diff --git a/vignettes/tinytable_assets/id13itwak34uq9l84h60sa.png b/vignettes/tinytable_assets/id13itwak34uq9l84h60sa.png new file mode 100644 index 00000000..8ec24e8d Binary files /dev/null and b/vignettes/tinytable_assets/id13itwak34uq9l84h60sa.png differ diff --git a/vignettes/tinytable_assets/id1icwfant8xf4qc7b4zet.png b/vignettes/tinytable_assets/id1icwfant8xf4qc7b4zet.png new file mode 100644 index 00000000..503d2298 Binary files /dev/null and b/vignettes/tinytable_assets/id1icwfant8xf4qc7b4zet.png differ diff --git a/vignettes/tinytable_assets/id1jii5c97zjqg9gtyu1ga.png b/vignettes/tinytable_assets/id1jii5c97zjqg9gtyu1ga.png new file mode 100644 index 00000000..8eaafeb9 Binary files /dev/null and b/vignettes/tinytable_assets/id1jii5c97zjqg9gtyu1ga.png differ diff --git a/vignettes/tinytable_assets/id1zjz2huqaiyrujec1f9q.png b/vignettes/tinytable_assets/id1zjz2huqaiyrujec1f9q.png new file mode 100644 index 00000000..79d2ec07 Binary files /dev/null and b/vignettes/tinytable_assets/id1zjz2huqaiyrujec1f9q.png differ diff --git a/vignettes/tinytable_assets/id2wb5tp711ufmqm6i7sgb.png b/vignettes/tinytable_assets/id2wb5tp711ufmqm6i7sgb.png new file mode 100644 index 00000000..e677d3ef Binary files /dev/null and b/vignettes/tinytable_assets/id2wb5tp711ufmqm6i7sgb.png differ diff --git a/vignettes/tinytable_assets/id3nm8ay15335jpiu0uvb0.png b/vignettes/tinytable_assets/id3nm8ay15335jpiu0uvb0.png new file mode 100644 index 00000000..0981e71f Binary files /dev/null and b/vignettes/tinytable_assets/id3nm8ay15335jpiu0uvb0.png differ diff --git a/vignettes/tinytable_assets/id6gyok2ywyrvi9v8j2jd0.png b/vignettes/tinytable_assets/id6gyok2ywyrvi9v8j2jd0.png new file mode 100644 index 00000000..5e33c88b Binary files /dev/null and b/vignettes/tinytable_assets/id6gyok2ywyrvi9v8j2jd0.png differ diff --git a/vignettes/tinytable_assets/id6wefmwp58tyzr9sweu89.png b/vignettes/tinytable_assets/id6wefmwp58tyzr9sweu89.png new file mode 100644 index 00000000..80279d32 Binary files /dev/null and b/vignettes/tinytable_assets/id6wefmwp58tyzr9sweu89.png differ diff --git a/vignettes/tinytable_assets/id7b1vbjqtmx626jslsn0x.png b/vignettes/tinytable_assets/id7b1vbjqtmx626jslsn0x.png new file mode 100644 index 00000000..0ba387fc Binary files /dev/null and b/vignettes/tinytable_assets/id7b1vbjqtmx626jslsn0x.png differ diff --git a/vignettes/tinytable_assets/id7fkcxjf9801woxlffwwk.png b/vignettes/tinytable_assets/id7fkcxjf9801woxlffwwk.png new file mode 100644 index 00000000..3ce82825 Binary files /dev/null and b/vignettes/tinytable_assets/id7fkcxjf9801woxlffwwk.png differ diff --git a/vignettes/tinytable_assets/id87hhm0f2em9qkjjknkfd.png b/vignettes/tinytable_assets/id87hhm0f2em9qkjjknkfd.png new file mode 100644 index 00000000..04b900e8 Binary files /dev/null and b/vignettes/tinytable_assets/id87hhm0f2em9qkjjknkfd.png differ diff --git a/vignettes/tinytable_assets/id8y7edynmv0r3os5eywdm.png b/vignettes/tinytable_assets/id8y7edynmv0r3os5eywdm.png new file mode 100644 index 00000000..d7222e0f Binary files /dev/null and b/vignettes/tinytable_assets/id8y7edynmv0r3os5eywdm.png differ diff --git a/vignettes/tinytable_assets/id9x6yez8lxf1srd4zy2wb.png b/vignettes/tinytable_assets/id9x6yez8lxf1srd4zy2wb.png new file mode 100644 index 00000000..82861ab5 Binary files /dev/null and b/vignettes/tinytable_assets/id9x6yez8lxf1srd4zy2wb.png differ diff --git a/vignettes/tinytable_assets/ida40d76rdgggzjwjc1lv6.png b/vignettes/tinytable_assets/ida40d76rdgggzjwjc1lv6.png new file mode 100644 index 00000000..cba1148d Binary files /dev/null and b/vignettes/tinytable_assets/ida40d76rdgggzjwjc1lv6.png differ diff --git a/vignettes/tinytable_assets/idbseh1vh65gb9g7j2v39b.png b/vignettes/tinytable_assets/idbseh1vh65gb9g7j2v39b.png new file mode 100644 index 00000000..5e2927f9 Binary files /dev/null and b/vignettes/tinytable_assets/idbseh1vh65gb9g7j2v39b.png differ diff --git a/vignettes/tinytable_assets/idgd0b0bzdkjl6bh7i6m9b.png b/vignettes/tinytable_assets/idgd0b0bzdkjl6bh7i6m9b.png new file mode 100644 index 00000000..213bef86 Binary files /dev/null and b/vignettes/tinytable_assets/idgd0b0bzdkjl6bh7i6m9b.png differ diff --git a/vignettes/tinytable_assets/idl3eusyitfl7gd6qjwu4v.png b/vignettes/tinytable_assets/idl3eusyitfl7gd6qjwu4v.png new file mode 100644 index 00000000..b6cc9f62 Binary files /dev/null and b/vignettes/tinytable_assets/idl3eusyitfl7gd6qjwu4v.png differ diff --git a/vignettes/tinytable_assets/ido71rkdkyqzw5vjqlds1s.png b/vignettes/tinytable_assets/ido71rkdkyqzw5vjqlds1s.png new file mode 100644 index 00000000..0e9656bb Binary files /dev/null and b/vignettes/tinytable_assets/ido71rkdkyqzw5vjqlds1s.png differ diff --git a/vignettes/tinytable_assets/idop5mvkyjykgy06rr3uk2.png b/vignettes/tinytable_assets/idop5mvkyjykgy06rr3uk2.png new file mode 100644 index 00000000..4369340f Binary files /dev/null and b/vignettes/tinytable_assets/idop5mvkyjykgy06rr3uk2.png differ diff --git a/vignettes/tinytable_assets/idp46mezg1wolc17t4o538.png b/vignettes/tinytable_assets/idp46mezg1wolc17t4o538.png new file mode 100644 index 00000000..e0b2cddc Binary files /dev/null and b/vignettes/tinytable_assets/idp46mezg1wolc17t4o538.png differ diff --git a/vignettes/tinytable_assets/idqdrl8jug01eit57h4zdg.png b/vignettes/tinytable_assets/idqdrl8jug01eit57h4zdg.png new file mode 100644 index 00000000..fa8a2afc Binary files /dev/null and b/vignettes/tinytable_assets/idqdrl8jug01eit57h4zdg.png differ diff --git a/vignettes/tinytable_assets/idr3kyry3bod5zwfd3tuez.png b/vignettes/tinytable_assets/idr3kyry3bod5zwfd3tuez.png new file mode 100644 index 00000000..f4e677bc Binary files /dev/null and b/vignettes/tinytable_assets/idr3kyry3bod5zwfd3tuez.png differ diff --git a/vignettes/tinytable_assets/idvk46p6o5phyb6h03qx10.png b/vignettes/tinytable_assets/idvk46p6o5phyb6h03qx10.png new file mode 100644 index 00000000..51ac33e1 Binary files /dev/null and b/vignettes/tinytable_assets/idvk46p6o5phyb6h03qx10.png differ diff --git a/vignettes/tinytable_assets/idy0z370udf0lmmxtbabru.png b/vignettes/tinytable_assets/idy0z370udf0lmmxtbabru.png new file mode 100644 index 00000000..1cfe3c01 Binary files /dev/null and b/vignettes/tinytable_assets/idy0z370udf0lmmxtbabru.png differ diff --git a/vignettes/tinytable_assets/idydnftaz35ngioblrundm.png b/vignettes/tinytable_assets/idydnftaz35ngioblrundm.png new file mode 100644 index 00000000..8bfece9c Binary files /dev/null and b/vignettes/tinytable_assets/idydnftaz35ngioblrundm.png differ diff --git a/vignettes/tinytable_assets/idzfvv5g5pa3y7uahefetv.png b/vignettes/tinytable_assets/idzfvv5g5pa3y7uahefetv.png new file mode 100644 index 00000000..5f1e6473 Binary files /dev/null and b/vignettes/tinytable_assets/idzfvv5g5pa3y7uahefetv.png differ diff --git a/vignettes/tinytable_tutorial.pdf b/vignettes/tinytable_tutorial.pdf index 5083e81b..30036024 100644 Binary files a/vignettes/tinytable_tutorial.pdf and b/vignettes/tinytable_tutorial.pdf differ

Combine two tiny tables.