diff --git a/CITATION.html b/CITATION.html index 2fcbbc99..03a7c9fb 100644 --- a/CITATION.html +++ b/CITATION.html @@ -232,7 +232,7 @@

Citation

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

Citation

@Manual{, title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', and 'PNG' Formats}, author = {Vincent Arel-Bundock}, - note = {R package version 0.0.2, https://github.com/vincentarelbundock/tinytable/}, + note = {R package version 0.0.2.9000, https://github.com/vincentarelbundock/tinytable/}, url = {https://vincentarelbundock.github.io/tinytable/}, } diff --git a/freeze.rds b/freeze.rds index f0541375..b4282a0e 100644 Binary files a/freeze.rds and b/freeze.rds differ diff --git a/man/format_tt.html b/man/format_tt.html index c8f351bc..701009f5 100644 --- a/man/format_tt.html +++ b/man/format_tt.html @@ -423,9 +423,9 @@

Examples

- tinytable_9fvsnuzsueldoorsoqmu + tinytable_od81nry2x6gyabhgd5bf @@ -443,7 +443,7 @@

Examples

- +
@@ -455,14 +455,14 @@

Examples

- + - + - + @@ -470,12 +470,12 @@

Examples

diff --git a/man/print.tinytable.html b/man/print.tinytable.html new file mode 100644 index 00000000..6bc7084e --- /dev/null +++ b/man/print.tinytable.html @@ -0,0 +1,676 @@ + + + + + + + + + +tinytable + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +
+ + + +
+ + + + +
10 00110 00010 001
10 00110 001 9 998
10 00010 001 9 999
+ + + + + + + + + + + + +
+x + +A data frame or data table to be rendered as a table. +
+output + +One of "latex", "markdown", "html". If NULL, will guess the output based on the environment (interactive, RStudio, etc.). +
+ + +Other arguments are ignored. +
+ +
+

Value

+

launch a browser window or cat() the table to console.

+ + +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/man/tt.html b/man/tt.html index 14259d99..5cbda27c 100644 --- a/man/tt.html +++ b/man/tt.html @@ -396,9 +396,9 @@

Examples

- tinytable_xiyoiznkxdzze7dz7w8m + tinytable_a3am230agrsxr8zcf5ca @@ -416,7 +416,7 @@

Examples

- +
@@ -462,12 +462,12 @@

Examples

@@ -496,9 +496,9 @@

Examples

- tinytable_cpnv1pv86yii1w6i6hmi + tinytable_x4eipuzgdkl8k2m8neny @@ -516,7 +516,7 @@

Examples

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

Examples

diff --git a/search.json b/search.json index 793e4109..86122002 100644 --- a/search.json +++ b/search.json @@ -48,7 +48,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', and 'PNG' Formats_. R package\n version 0.0.2, https://github.com/vincentarelbundock/tinytable/,\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', and 'PNG' Formats},\n author = {Vincent Arel-Bundock},\n note = {R package version 0.0.2, https://github.com/vincentarelbundock/tinytable/},\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', and 'PNG' Formats_. R package\n version 0.0.2.9000, https://github.com/vincentarelbundock/tinytable/,\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', and 'PNG' Formats},\n author = {Vincent Arel-Bundock},\n note = {R package version 0.0.2.9000, https://github.com/vincentarelbundock/tinytable/},\n url = {https://vincentarelbundock.github.io/tinytable/},\n }", "crumbs": [ "Tutorial (HTML)", "Citation" @@ -149,14 +149,28 @@ "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.\n\n\n\nformat_tt(\n x,\n j = NULL,\n digits = getOption(\"digits\"),\n num_fmt = \"significant\",\n num_zero = TRUE,\n num_suffix = FALSE,\n num_mark_big = \"\",\n num_mark_dec = getOption(\"OutDec\", default = \".\"),\n date = \"%Y-%m-%d\",\n bool = function(column) tools::toTitleCase(tolower(column)),\n other = as.character,\n markdown = FALSE,\n sprintf = NULL\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be a single value, a vector, or a Perl-style regular expression applied to column names of the original data frame. If colspan is used, j must be of length 1.\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’, ‘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\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\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\nA data frame with formatted columns.\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- format_tt(dat,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\ntt(tab)\n\n \n\n \n \n \n tinytable_9fvsnuzsueldoorsoqmu\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 10 001\n 10 001\n \n \n 10 000\n 9 999" + "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.\n\n\n\nformat_tt(\n x,\n j = NULL,\n digits = getOption(\"digits\"),\n num_fmt = \"significant\",\n num_zero = TRUE,\n num_suffix = FALSE,\n num_mark_big = \"\",\n num_mark_dec = getOption(\"OutDec\", default = \".\"),\n date = \"%Y-%m-%d\",\n bool = function(column) tools::toTitleCase(tolower(column)),\n other = as.character,\n markdown = FALSE,\n sprintf = NULL\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be a single value, a vector, or a Perl-style regular expression applied to column names of the original data frame. If colspan is used, j must be of length 1.\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’, ‘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\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\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\nA data frame with formatted columns.\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- format_tt(dat,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\ntt(tab)\n\n \n\n \n \n \n tinytable_od81nry2x6gyabhgd5bf\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 001\n \n \n 10 001\n 9 998\n \n \n 10 001\n 9 999" }, { "objectID": "man/format_tt.html#format-columns-of-a-data-frame", "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.\n\n\n\nformat_tt(\n x,\n j = NULL,\n digits = getOption(\"digits\"),\n num_fmt = \"significant\",\n num_zero = TRUE,\n num_suffix = FALSE,\n num_mark_big = \"\",\n num_mark_dec = getOption(\"OutDec\", default = \".\"),\n date = \"%Y-%m-%d\",\n bool = function(column) tools::toTitleCase(tolower(column)),\n other = as.character,\n markdown = FALSE,\n sprintf = NULL\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be a single value, a vector, or a Perl-style regular expression applied to column names of the original data frame. If colspan is used, j must be of length 1.\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’, ‘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\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\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\nA data frame with formatted columns.\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- format_tt(dat,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\ntt(tab)\n\n \n\n \n \n \n tinytable_9fvsnuzsueldoorsoqmu\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 10 001\n 10 001\n \n \n 10 000\n 9 999" + "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.\n\n\n\nformat_tt(\n x,\n j = NULL,\n digits = getOption(\"digits\"),\n num_fmt = \"significant\",\n num_zero = TRUE,\n num_suffix = FALSE,\n num_mark_big = \"\",\n num_mark_dec = getOption(\"OutDec\", default = \".\"),\n date = \"%Y-%m-%d\",\n bool = function(column) tools::toTitleCase(tolower(column)),\n other = as.character,\n markdown = FALSE,\n sprintf = NULL\n)\n\n\n\n\n\n\n\nx\n\n\nA data frame or a vector to be formatted.\n\n\n\n\nj\n\n\nColumn indices where the styling should be applied. Can be a single value, a vector, or a Perl-style regular expression applied to column names of the original data frame. If colspan is used, j must be of length 1.\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’, ‘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\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\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\nA data frame with formatted columns.\n\n\n\n\nlibrary(tinytable)\n\ndat <- data.frame(\n a = rnorm(3, mean = 10000),\n b = rnorm(3, 10000))\ntab <- format_tt(dat,\n digits = 2,\n num_mark_dec = \",\",\n num_mark_big = \" \")\ntt(tab)\n\n \n\n \n \n \n tinytable_od81nry2x6gyabhgd5bf\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 001\n \n \n 10 001\n 9 998\n \n \n 10 001\n 9 999" + }, + { + "objectID": "man/print.tinytable.html", + "href": "man/print.tinytable.html", + "title": "tinytable", + "section": "", + "text": "Print a tinytable to console or viewer pane\n\n\n\n## S3 method for class 'tinytable'\nprint(x, output = getOption(\"tinytable_print_output\", default = NULL), ...)\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\noutput\n\n\nOne of \"latex\", \"markdown\", \"html\". If NULL, will guess the output based on the environment (interactive, RStudio, etc.).\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nlaunch a browser window or cat() the table to console." + }, + { + "objectID": "man/print.tinytable.html#print-a-tinytable-to-console-or-viewer-pane", + "href": "man/print.tinytable.html#print-a-tinytable-to-console-or-viewer-pane", + "title": "tinytable", + "section": "", + "text": "Print a tinytable to console or viewer pane\n\n\n\n## S3 method for class 'tinytable'\nprint(x, output = getOption(\"tinytable_print_output\", default = NULL), ...)\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\noutput\n\n\nOne of \"latex\", \"markdown\", \"html\". If NULL, will guess the output based on the environment (interactive, RStudio, etc.).\n\n\n\n\n…\n\n\nOther arguments are ignored.\n\n\n\n\n\n\nlaunch a browser window or cat() the table to console." }, { "objectID": "man/plot_tt.html", @@ -187,7 +201,7 @@ "href": "man/tt.html", "title": "tinytable", "section": "", - "text": "The tt function renders a table in different formats (HTML, Markdown, or LaTeX) with various styling options. The table can be customized with additional functions:\n\n\nstyle_tt() to style fonts, colors, alignment, etc.\n\n\nformat_tt() to format numbers, dates, strings, etc.\n\n\nsave_tt() to save the table to a file or return the table as a string.\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 = NULL,\n caption = NULL,\n width = NULL,\n notes = NULL,\n theme = \"default\",\n placement = getOption(\"tinytable_tabularray_placement\", default = NULL)\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. Users who need more control can proceed in two steps: (1) format the data with format_tt() or other functions, and (2) pass the formatted data to tt() for drawing. See ?format_tt for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.).\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table.\n\n\n\n\nwidth\n\n\nA numeric value between 0 and 1 indicating the proportion of the line width that the table should cover.\n\n\n\n\nnotes\n\n\nA single string or a (named) list of strings to append at the bottom of the table.\n\n\n\n\ntheme\n\n\nThe theme to apply to the table: \"default\", \"striped\", \"bootstrap\", \"void\", or \"grid\".\n\n\n\n\nplacement\n\n\nA string to control the position of tables in LaTeX. Will be inserted in square brackets like: \\begin{table}[H]\n\n\n\n\n\n\nAn object of class tt representing the table.\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{codehigh}\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\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_xiyoiznkxdzze7dz7w8m\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,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_cpnv1pv86yii1w6i6hmi\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\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 tt function renders a table in different formats (HTML, Markdown, or LaTeX) with various styling options. The table can be customized with additional functions:\n\n\nstyle_tt() to style fonts, colors, alignment, etc.\n\n\nformat_tt() to format numbers, dates, strings, etc.\n\n\nsave_tt() to save the table to a file or return the table as a string.\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 = NULL,\n caption = NULL,\n width = NULL,\n notes = NULL,\n theme = \"default\",\n placement = getOption(\"tinytable_tabularray_placement\", default = NULL)\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. Users who need more control can proceed in two steps: (1) format the data with format_tt() or other functions, and (2) pass the formatted data to tt() for drawing. See ?format_tt for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.).\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table.\n\n\n\n\nwidth\n\n\nA numeric value between 0 and 1 indicating the proportion of the line width that the table should cover.\n\n\n\n\nnotes\n\n\nA single string or a (named) list of strings to append at the bottom of the table.\n\n\n\n\ntheme\n\n\nThe theme to apply to the table: \"default\", \"striped\", \"bootstrap\", \"void\", or \"grid\".\n\n\n\n\nplacement\n\n\nA string to control the position of tables in LaTeX. Will be inserted in square brackets like: \\begin{table}[H]\n\n\n\n\n\n\nAn object of class tt representing the table.\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{codehigh}\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\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_a3am230agrsxr8zcf5ca\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,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_x4eipuzgdkl8k2m8neny\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\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 (HTML)", "Functions", @@ -199,7 +213,7 @@ "href": "man/tt.html#draw-a-tiny-table", "title": "tinytable", "section": "", - "text": "The tt function renders a table in different formats (HTML, Markdown, or LaTeX) with various styling options. The table can be customized with additional functions:\n\n\nstyle_tt() to style fonts, colors, alignment, etc.\n\n\nformat_tt() to format numbers, dates, strings, etc.\n\n\nsave_tt() to save the table to a file or return the table as a string.\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 = NULL,\n caption = NULL,\n width = NULL,\n notes = NULL,\n theme = \"default\",\n placement = getOption(\"tinytable_tabularray_placement\", default = NULL)\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. Users who need more control can proceed in two steps: (1) format the data with format_tt() or other functions, and (2) pass the formatted data to tt() for drawing. See ?format_tt for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.).\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table.\n\n\n\n\nwidth\n\n\nA numeric value between 0 and 1 indicating the proportion of the line width that the table should cover.\n\n\n\n\nnotes\n\n\nA single string or a (named) list of strings to append at the bottom of the table.\n\n\n\n\ntheme\n\n\nThe theme to apply to the table: \"default\", \"striped\", \"bootstrap\", \"void\", or \"grid\".\n\n\n\n\nplacement\n\n\nA string to control the position of tables in LaTeX. Will be inserted in square brackets like: \\begin{table}[H]\n\n\n\n\n\n\nAn object of class tt representing the table.\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{codehigh}\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\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_xiyoiznkxdzze7dz7w8m\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,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_cpnv1pv86yii1w6i6hmi\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\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 tt function renders a table in different formats (HTML, Markdown, or LaTeX) with various styling options. The table can be customized with additional functions:\n\n\nstyle_tt() to style fonts, colors, alignment, etc.\n\n\nformat_tt() to format numbers, dates, strings, etc.\n\n\nsave_tt() to save the table to a file or return the table as a string.\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 = NULL,\n caption = NULL,\n width = NULL,\n notes = NULL,\n theme = \"default\",\n placement = getOption(\"tinytable_tabularray_placement\", default = NULL)\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. Users who need more control can proceed in two steps: (1) format the data with format_tt() or other functions, and (2) pass the formatted data to tt() for drawing. See ?format_tt for more details on formating options (ex: decimal, scientific notation, dates, boolean variables, etc.).\n\n\n\n\ncaption\n\n\nA string that will be used as the caption of the table.\n\n\n\n\nwidth\n\n\nA numeric value between 0 and 1 indicating the proportion of the line width that the table should cover.\n\n\n\n\nnotes\n\n\nA single string or a (named) list of strings to append at the bottom of the table.\n\n\n\n\ntheme\n\n\nThe theme to apply to the table: \"default\", \"striped\", \"bootstrap\", \"void\", or \"grid\".\n\n\n\n\nplacement\n\n\nA string to control the position of tables in LaTeX. Will be inserted in square brackets like: \\begin{table}[H]\n\n\n\n\n\n\nAn object of class tt representing the table.\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{codehigh}\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\nlibrary(tinytable)\n\nlibrary(tinytable)\nx <- mtcars[1:4, 1:5]\n\ntt(x)\n\n \n\n \n \n \n tinytable_a3am230agrsxr8zcf5ca\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,\n theme = \"striped\",\n width = 0.5,\n caption = \"Data about cars.\")\n\n \n\n \n \n \n tinytable_x4eipuzgdkl8k2m8neny\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\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 (HTML)", "Functions", @@ -264,52 +278,42 @@ "Tutorial (HTML)" ] }, - { - "objectID": "vignettes/tutorial.html#output-formats", - "href": "vignettes/tutorial.html#output-formats", - "title": "tinytable", - "section": "Output formats", - "text": "Output formats\ntinytable can produce tables in HTML, Word, Markdown, LaTeX, 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+------+-------------+------------+\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 | 146.7 | 62 | 3.69 |\n+------+-----+-------+-----+------+\n| 22.8 | 4 | 140.8 | 95 | 3.92 |\n+------+-----+-------+-----+------+\n| 19.2 | 6 | 167.6 | 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 | 146.7 | 62 | 3.69 |\\n+------+-----+-------+-----+------+\\n| 22.8 | 4 | 140.8 | 95 | 3.92 |\\n+------+-----+-------+-----+------+\\n| 19.2 | 6 | 167.6 | 123 | 3.92 |\\n+------+-----+-------+-----+------+\"", - "crumbs": [ - "Tutorial (HTML)" - ] - }, { "objectID": "vignettes/tutorial.html#themes", "href": "vignettes/tutorial.html#themes", "title": "tinytable", "section": "Themes", - "text": "Themes\ntinytable offers a few basic themes out of the box: “default”, “striped”, “bootstrap”, “grid”, “void.” Those themes can be applied with the theme argument of the tt() function. As we will see below, it is easy to go much beyond those basic settings to customize your own tables. Here we only illustrate a few of the simplest settings:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_hiyjjqe1qlv1wiigdg1z\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_t1fy4gtin8vn5egilf3d\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_mgkzn9vb0arh7vr0uit7\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": "Themes\ntinytable offers a few basic themes out of the box: “default”, “striped”, “bootstrap”, “grid”, “void.” Those themes can be applied with the theme argument of the tt() function. As we will see below, it is easy to go much beyond those basic settings to customize your own tables. Here we only illustrate a few of the simplest settings:\n\ntt(x, theme = \"striped\")\n\n \n\n \n \n \n tinytable_l8f2wk1bq373aeanv9om\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_6rn9mctzlzwkhd1olybm\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_rmixurrdryvbj7shytwb\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 (HTML)" ] }, { - "objectID": "vignettes/tutorial.html#alignment", - "href": "vignettes/tutorial.html#alignment", + "objectID": "vignettes/tutorial.html#width", + "href": "vignettes/tutorial.html#width", "title": "tinytable", - "section": "Alignment", - "text": "Alignment\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_ghu1fmkqwq43vsgsfqfy\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_ulhrdw03vg2d9ev18bg6\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", + "section": "Width", + "text": "Width\nThe width arguments accepts a number between 0 and 1, indicating what proportion of the linewidth the table should cover:\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_5cthvq6k97urueuavt0v\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_zs61ffpauk2rf8zk8f86\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 (HTML)" ] }, { - "objectID": "vignettes/tutorial.html#formatting-numbers-dates-strings-etc.", - "href": "vignettes/tutorial.html#formatting-numbers-dates-strings-etc.", + "objectID": "vignettes/tutorial.html#captions-and-cross-references", + "href": "vignettes/tutorial.html#captions-and-cross-references", "title": "tinytable", - "section": "Formatting (numbers, dates, strings, etc.)", - "text": "Formatting (numbers, dates, strings, etc.)\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)),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_otjlh1vsr4wc97pdv7eu\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 1972-09-16\n True\n \n \n 201399\n 201.40\n 1970-11-16\n True\n \n \n 100188\n 0.13\n 1970-06-04\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_f34iqa8wsklp5lyzbbk3\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 September 16 1972\n True\n \n \n 201 399,18\n 201.4\n November 16 1970\n True\n \n \n 100 188,39\n 0.1\n June 04 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_8erslhcdbkpaonxiweje\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 98.94T\n \n \n Food: Halloumi\n 201.399\n 7.29B\n \n \n Food: Tofu\n 0.146\n 29.11M\n \n \n Food: Beans\n 0.003\n 93.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.4 98.9T\n2 Halloumi 201.4 7.3B\n3 Tofu 0.1 29.1M\n4 Beans 0.0 93.9K", + "section": "Captions and cross-references", + "text": "Captions and cross-references\nIn Quarto, one can specify captions and use cross-references using code like this:\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], placement = NULL)\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_thdlpxw5ybgtxx701i4l\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\nFor standalone LaTeX tables, you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")\n\nBe aware that this more approach may not work well in Quarto or Rmarkdown documents.", "crumbs": [ "Tutorial (HTML)" ] }, { - "objectID": "vignettes/tutorial.html#width", - "href": "vignettes/tutorial.html#width", + "objectID": "vignettes/tutorial.html#footnotes", + "href": "vignettes/tutorial.html#footnotes", "title": "tinytable", - "section": "Width", - "text": "Width\nThe width arguments accepts a number between 0 and 1, indicating what proportion of the linewidth the table should cover:\n\ntt(x, width = 0.5)\n\n \n\n \n \n \n tinytable_ajbbpkzqao1eqdzzrbc0\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_aft1cs5iydpwrbsf274n\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", + "section": "Footnotes", + "text": "Footnotes\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\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, notes = n, width = 1)\n\n \n\n \n \n \n tinytable_mrkxs5cc5xae6f6ooego\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_v70c60ukdimviirw7kc8\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", "crumbs": [ "Tutorial (HTML)" ] @@ -319,37 +323,27 @@ "href": "vignettes/tutorial.html#line-breaks-and-text-wrapping", "title": "tinytable", "section": "Line breaks and text wrapping", - "text": "Line breaks and text wrapping\nWhen the width argument is specified and a cell includes long text, the text is automatically wrapped to match the table.\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)\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_f331y4dmybh0r0q7cudi\n \n \n \n \n \n\n \n \n A full width table with wrapped text.\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\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_zn31yzac3dutfjr2kqk6\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 (HTML)" - ] - }, - { - "objectID": "vignettes/tutorial.html#captions-and-cross-references", - "href": "vignettes/tutorial.html#captions-and-cross-references", - "title": "tinytable", - "section": "Captions and cross-references", - "text": "Captions and cross-references\nIn Quarto, one can specify captions and use cross-references using code like this:\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], placement = NULL)\n\n\n\nTable 1: Blah blah blah\n\n\n\n \n\n \n \n \n tinytable_7nwz2rn468b4yuc7t94j\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\nFor standalone LaTeX tables, you can use the caption argument like so:\n\ntt(x, caption = \"Blah blah.\\\\label{tbl-blah}\")\n\nBe aware that this more approach may not work well in Quarto or Rmarkdown documents.", + "text": "Line breaks and text wrapping\nWhen the width argument is specified and a cell includes long text, the text is automatically wrapped to match the table.\n\ntt(lorem, width = 3/4)\n\n \n\n \n \n \n tinytable_qbegz2p3tedwd7l23o58\n \n \n \n \n \n\n \n \n A full width table with wrapped text.\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\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_xw1m576f763umf7fsc12\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 (HTML)" ] }, { - "objectID": "vignettes/tutorial.html#footnotes", - "href": "vignettes/tutorial.html#footnotes", + "objectID": "vignettes/tutorial.html#math", + "href": "vignettes/tutorial.html#math", "title": "tinytable", - "section": "Footnotes", - "text": "Footnotes\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_3mjl6w7074z2662hoajk\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_g7kcqtks5nwr697n1vm7\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", + "section": "Math", + "text": "Math\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_xnoh0l1oey8t6nbsjz95\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 (HTML)" ] }, { - "objectID": "vignettes/tutorial.html#math", - "href": "vignettes/tutorial.html#math", + "objectID": "vignettes/tutorial.html#numbers-dates-strings-etc.", + "href": "vignettes/tutorial.html#numbers-dates-strings-etc.", "title": "tinytable", - "section": "Math", - "text": "Math\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_z02lq1f30t09kw4qlgc8\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}$", + "section": "Numbers, dates, strings, etc.", + "text": "Numbers, dates, strings, etc.\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)),\n z = c(TRUE, TRUE, FALSE))\n\ntt(dat, digits = 2)\n\n \n\n \n \n \n tinytable_9l6jql857lenqoypv2n5\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-01-13\n True\n \n \n 201399\n 201.40\n 1972-07-13\n True\n \n \n 100188\n 0.13\n 1970-03-03\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_mfqjwewhfuhy9mhynvas\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 January 13 1971\n True\n \n \n 201 399,18\n 201.4\n July 13 1972\n True\n \n \n 100 188,39\n 0.1\n March 03 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_ekkuagw1mkyz6qvj79er\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 98.94T\n \n \n Food: Halloumi\n 201.399\n 7.29B\n \n \n Food: Tofu\n 0.146\n 29.11M\n \n \n Food: Beans\n 0.003\n 93.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.4 98.9T\n2 Halloumi 201.4 7.3B\n3 Tofu 0.1 29.1M\n4 Beans 0.0 93.9K", "crumbs": [ "Tutorial (HTML)" ] @@ -359,7 +353,7 @@ "href": "vignettes/tutorial.html#markdown", "title": "tinytable", "section": "Markdown", - "text": "Markdown\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_stt52p2lsnhvxdu158n2\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_ejtw704nzfx22k9f2wji\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\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_oi7gg8skpyvwg6542jb0\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_a4aov2lb3j9beb8g6mku\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 (HTML)" ] @@ -369,7 +363,7 @@ "href": "vignettes/tutorial.html#cells-rows-columns", "title": "tinytable", "section": "Cells, rows, columns", - "text": "Cells, rows, columns\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_mcc67y9zhoczbtl35lq7\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_0hdjvpthwz0c83twxdr9\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_a7decaxcd2wcj78t06q3\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_stk1xvg022v8kba2jetz\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_vmpvvwg787pau5ed9vsk\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, 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 = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_w5orkop93jgc2stmhq5k\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_ar9qd45jijti9nxkzbl2\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": "Cells, rows, columns\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_ryxwvh24zyyfbb1imbgd\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_4skaf7admzeg85a4c97w\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_bhl6rvelig1tskm1o6tz\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_xc1sep3h6a4loxt8ofcd\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_6r517hmi6d335sut28we\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, 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 = \"mpg|drat\", color = \"orange\")\n\n \n\n \n \n \n tinytable_et9pzdl5om5xdoo38h2y\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_a8xfr4m7ju9blqjhhmqe\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 (HTML)" ] @@ -379,7 +373,17 @@ "href": "vignettes/tutorial.html#colors", "title": "tinytable", "section": "Colors", - "text": "Colors\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_f940w5uyr11msudkrfi3\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": "Colors\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_lmicvbmhzqoffnl6snxm\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 (HTML)" + ] + }, + { + "objectID": "vignettes/tutorial.html#alignment", + "href": "vignettes/tutorial.html#alignment", + "title": "tinytable", + "section": "Alignment", + "text": "Alignment\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_ky3q1cbo1bn9avf423no\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_yekdcq0a1gknz3qg57ai\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", "crumbs": [ "Tutorial (HTML)" ] @@ -389,7 +393,7 @@ "href": "vignettes/tutorial.html#fonts", "title": "tinytable", "section": "Fonts", - "text": "Fonts\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_ohelvt1iyhsrvipiomkl\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": "Fonts\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_myxo7ly1a0ey9hr0wnek\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 (HTML)" ] @@ -399,7 +403,7 @@ "href": "vignettes/tutorial.html#headers", "title": "tinytable", "section": "Headers", - "text": "Headers\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_ripj208ouuypt1wvwlu7\n \n \n \n \n \n\n \n \n \n \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 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_lvwrfm9oo3mhm01jvjtb\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_trq2sd4nwr58hay8jxhd\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": "Headers\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_u550veqwwrrawb75squ2\n \n \n \n \n \n\n \n \n \n \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 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_napy0tzqhwsg49ybmv75\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_gj7amndve79wox5t7yxi\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 (HTML)" ] @@ -409,7 +413,7 @@ "href": "vignettes/tutorial.html#conditional-styling", "title": "tinytable", "section": "Conditional styling", - "text": "Conditional styling\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_8s59n89kozhipfkmj0n7\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": "Conditional styling\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_1s55fhvo85fds8iti1uh\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 (HTML)" ] @@ -419,7 +423,7 @@ "href": "vignettes/tutorial.html#vectorized-styling-heatmaps", "title": "tinytable", "section": "Vectorized styling (heatmaps)", - "text": "Vectorized styling (heatmaps)\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_w9s67lnjkaxhxpf2mi7e\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_m9gztozqi3hdshq5rl37\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_2rowcapqhhjjcvzerl6b\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\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", + "text": "Vectorized styling (heatmaps)\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_y4we0jlzq13dfh59v1tv\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_fov7hgr4fphsh6rocnve\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_9q1g02vn2p78lcarqo6y\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\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", "crumbs": [ "Tutorial (HTML)" ] @@ -429,7 +433,7 @@ "href": "vignettes/tutorial.html#lines-borders", "title": "tinytable", "section": "Lines (borders)", - "text": "Lines (borders)\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_qfhs5jo3e3izc1ttja3s\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_je8oummvitcvhvcrmu84\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": "Lines (borders)\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_0r0s0vs362owdbgj30cj\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_7klek3ruy054dsair2sf\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 (HTML)" ] @@ -439,7 +443,7 @@ "href": "vignettes/tutorial.html#inserting-images-in-tables", "title": "tinytable", "section": "Inserting images in tables", - "text": "Inserting images in tables\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_td0qibt9aaqk0jtkbnmc\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_w4a4ibtj5mwdqacxxj80\n \n \n \n \n \n\n \n \n \n \n \n \n R", + "text": "Inserting images in tables\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_ish771xwslqd459l8v4b\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_pl7co7u74up9z6ezhy2p\n \n \n \n \n \n\n \n \n \n \n \n \n R", "crumbs": [ "Tutorial (HTML)" ] @@ -449,7 +453,7 @@ "href": "vignettes/tutorial.html#inline-plots", "title": "tinytable", "section": "Inline plots", - "text": "Inline plots\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\nBuilt-in plots\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)\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 style_tt(j = 2:4, align = \"c\")\n\n \n\n \n \n \n tinytable_p0lhymkkerl49d6uhz5q\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n \n \n \n \n \n mpg\n \n \n \n \n \n hp\n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\nCustom plots: Base R\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_1lnssh6op3okpeaw2k0r\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\nCustom plots: ggplot2\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_67u4od5nr9gc7wb4h2jb\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\nlibrary(palmerpenguins)\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_a5u3cx5l2vlivnsgf8vu\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": "Inline plots\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\nBuilt-in plots\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)\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 style_tt(j = 2:4, align = \"c\")\n\n \n\n \n \n \n tinytable_9n3a09p3ze21nspltw9n\n \n \n \n \n \n\n \n \n \n \n \n \n Variables\n Histogram\n Density\n Bar\n \n \n \n \n \n mpg\n \n \n \n \n \n hp\n \n \n \n \n \n qsec\n \n \n \n \n \n \n \n\n \n\n \n\n\n\n\n\n\nCustom plots: Base R\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_r5qpf4digbmz7yytrryj\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\nCustom plots: ggplot2\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_sf9jec4lebp4plgtavoj\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\nlibrary(palmerpenguins)\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_yz5ofetzw7ipgs19x6y7\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 (HTML)" ] @@ -459,7 +463,7 @@ "href": "vignettes/tutorial.html#rows", "title": "tinytable", "section": "Rows", - "text": "Rows\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_hny95hadq4x5fsoo0gs0\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\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_xssqb7ag1au1dkj9fl7t\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.15\n 22.9\n 1", + "text": "Rows\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_4fils2d2ecz24gkgkobs\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\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_iayl31uofqkx39mturgm\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.15\n 22.9\n 1", "crumbs": [ "Tutorial (HTML)" ] @@ -469,7 +473,7 @@ "href": "vignettes/tutorial.html#columns", "title": "tinytable", "section": "Columns", - "text": "Columns\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_bdl6o4hgvjzfpqio4xqe\n \n \n \n \n \n\n \n \n \n \nHamburgers\nHalloumi\n \nTofu\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\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_gy475alkairgc7lnktxv\n \n \n \n \n \n\n \n \n \n \nHamburgers\nHalloumi\n \nTofu\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.15\n 22.9\n 1", + "text": "Columns\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_3nl94vabig3gn6ax1uju\n \n \n \n \n \n\n \n \n \n \nHamburgers\nHalloumi\n \nTofu\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\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_szud3ofi4maenhjozohe\n \n \n \n \n \n\n \n \n \n \nHamburgers\nHalloumi\n \nTofu\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.46\n 0\n \n \n 21\n 6\n 160\n 110\n 3.9\n 2.875\n 17.02\n 0\n \n \n 22.8\n 4\n 108\n 93\n 3.85\n 2.32\n 18.61\n 1\n \n \n 21.4\n 6\n 258\n 110\n 3.08\n 3.215\n 19.44\n 1\n \n \n 18.7\n 8\n 360\n 175\n 3.15\n 3.44\n 17.02\n 0\n \n \n 18.1\n 6\n 225\n 105\n 2.76\n 3.46\n 20.22\n 1\n \n \n 14.3\n 8\n 360\n 245\n 3.21\n 3.57\n 15.84\n 0\n \n \n 24.4\n 4\n 146.7\n 62\n 3.69\n 3.19\n 20\n 1\n \n \n 22.8\n 4\n 140.8\n 95\n 3.92\n 3.15\n 22.9\n 1", "crumbs": [ "Tutorial (HTML)" ] @@ -479,7 +483,7 @@ "href": "vignettes/tutorial.html#bootstrap-classes", "title": "tinytable", "section": "Bootstrap classes", - "text": "Bootstrap classes\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_hn4fhzn1gybsfgtoyl3z\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_6i4j602g4qeu3hth8bvu\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": "Bootstrap classes\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_asny8o1nx2pcd5u2znv6\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_n734w26xhlnwckicgtfl\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 (HTML)" ] @@ -489,7 +493,7 @@ "href": "vignettes/tutorial.html#css-declarations", "title": "tinytable", "section": "CSS declarations", - "text": "CSS declarations\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_484lw5mgfdyeg8zlr7o3\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": "CSS declarations\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_i3bw6bhghbxlumosel6z\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 (HTML)" ] @@ -499,7 +503,7 @@ "href": "vignettes/tutorial.html#css-rules", "title": "tinytable", "section": "CSS rules", - "text": "CSS rules\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_vbdc8q0qtpz72jxjkdem\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": "CSS rules\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_rqfxoy1fiabbu6vs3s0n\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 (HTML)" ] diff --git a/vignettes/tinytable_assets/id07u0vtltkzo3jyupe7c1.png b/vignettes/tinytable_assets/id07u0vtltkzo3jyupe7c1.png new file mode 100644 index 00000000..04b900e8 Binary files /dev/null and b/vignettes/tinytable_assets/id07u0vtltkzo3jyupe7c1.png differ diff --git a/vignettes/tinytable_assets/id3c37dh6kxe2aoscmm0ad.png b/vignettes/tinytable_assets/id3c37dh6kxe2aoscmm0ad.png new file mode 100644 index 00000000..79205456 Binary files /dev/null and b/vignettes/tinytable_assets/id3c37dh6kxe2aoscmm0ad.png differ diff --git a/vignettes/tinytable_assets/id50j3pxowi6l0kbeouyuv.png b/vignettes/tinytable_assets/id50j3pxowi6l0kbeouyuv.png new file mode 100644 index 00000000..8eaafeb9 Binary files /dev/null and b/vignettes/tinytable_assets/id50j3pxowi6l0kbeouyuv.png differ diff --git a/vignettes/tinytable_assets/id7k2t3obo8jjuozwxw4us.png b/vignettes/tinytable_assets/id7k2t3obo8jjuozwxw4us.png new file mode 100644 index 00000000..5e2927f9 Binary files /dev/null and b/vignettes/tinytable_assets/id7k2t3obo8jjuozwxw4us.png differ diff --git a/vignettes/tinytable_assets/id7nld7gphtvtj5lt5k517.png b/vignettes/tinytable_assets/id7nld7gphtvtj5lt5k517.png new file mode 100644 index 00000000..0ba387fc Binary files /dev/null and b/vignettes/tinytable_assets/id7nld7gphtvtj5lt5k517.png differ diff --git a/vignettes/tinytable_assets/id7u1wregm1vrxpqexrny6.png b/vignettes/tinytable_assets/id7u1wregm1vrxpqexrny6.png new file mode 100644 index 00000000..5e33c88b Binary files /dev/null and b/vignettes/tinytable_assets/id7u1wregm1vrxpqexrny6.png differ diff --git a/vignettes/tinytable_assets/ida4gyp3isqu07tskwwp1q.png b/vignettes/tinytable_assets/ida4gyp3isqu07tskwwp1q.png new file mode 100644 index 00000000..95e77745 Binary files /dev/null and b/vignettes/tinytable_assets/ida4gyp3isqu07tskwwp1q.png differ diff --git a/vignettes/tinytable_assets/idbcygem04elh31r4uazlv.png b/vignettes/tinytable_assets/idbcygem04elh31r4uazlv.png new file mode 100644 index 00000000..e0b2cddc Binary files /dev/null and b/vignettes/tinytable_assets/idbcygem04elh31r4uazlv.png differ diff --git a/vignettes/tinytable_assets/iddm6t2v3i6m4k383teqmf.png b/vignettes/tinytable_assets/iddm6t2v3i6m4k383teqmf.png new file mode 100644 index 00000000..8ec24e8d Binary files /dev/null and b/vignettes/tinytable_assets/iddm6t2v3i6m4k383teqmf.png differ diff --git a/vignettes/tinytable_assets/idgo00gxzkl2nitfxz1wyl.png b/vignettes/tinytable_assets/idgo00gxzkl2nitfxz1wyl.png new file mode 100644 index 00000000..4e1ff0a7 Binary files /dev/null and b/vignettes/tinytable_assets/idgo00gxzkl2nitfxz1wyl.png differ diff --git a/vignettes/tinytable_assets/idhxis63aeqbmgm70wlhw0.png b/vignettes/tinytable_assets/idhxis63aeqbmgm70wlhw0.png new file mode 100644 index 00000000..b6465812 Binary files /dev/null and b/vignettes/tinytable_assets/idhxis63aeqbmgm70wlhw0.png differ diff --git a/vignettes/tinytable_assets/idilupib9dp0ft992xk7vq.png b/vignettes/tinytable_assets/idilupib9dp0ft992xk7vq.png new file mode 100644 index 00000000..3f008627 Binary files /dev/null and b/vignettes/tinytable_assets/idilupib9dp0ft992xk7vq.png differ diff --git a/vignettes/tinytable_assets/idllnelqaxr3le6o9sn2dy.png b/vignettes/tinytable_assets/idllnelqaxr3le6o9sn2dy.png new file mode 100644 index 00000000..f3f966d9 Binary files /dev/null and b/vignettes/tinytable_assets/idllnelqaxr3le6o9sn2dy.png differ diff --git a/vignettes/tinytable_assets/idowr93707lp0epyrnbg68.png b/vignettes/tinytable_assets/idowr93707lp0epyrnbg68.png new file mode 100644 index 00000000..79a35013 Binary files /dev/null and b/vignettes/tinytable_assets/idowr93707lp0epyrnbg68.png differ diff --git a/vignettes/tinytable_assets/idpcsory2hzkexc5lqac73.png b/vignettes/tinytable_assets/idpcsory2hzkexc5lqac73.png new file mode 100644 index 00000000..6cee967b Binary files /dev/null and b/vignettes/tinytable_assets/idpcsory2hzkexc5lqac73.png differ diff --git a/vignettes/tinytable_assets/idr7z6wilatf3rj9igt8rl.png b/vignettes/tinytable_assets/idr7z6wilatf3rj9igt8rl.png new file mode 100644 index 00000000..fa8a2afc Binary files /dev/null and b/vignettes/tinytable_assets/idr7z6wilatf3rj9igt8rl.png differ diff --git a/vignettes/tinytable_assets/idrd7pceyhlhxnfsx7y9ro.png b/vignettes/tinytable_assets/idrd7pceyhlhxnfsx7y9ro.png new file mode 100644 index 00000000..80279d32 Binary files /dev/null and b/vignettes/tinytable_assets/idrd7pceyhlhxnfsx7y9ro.png differ diff --git a/vignettes/tinytable_assets/idtd3w939qaw45rknp9yx5.png b/vignettes/tinytable_assets/idtd3w939qaw45rknp9yx5.png new file mode 100644 index 00000000..82861ab5 Binary files /dev/null and b/vignettes/tinytable_assets/idtd3w939qaw45rknp9yx5.png differ diff --git a/vignettes/tinytable_assets/idtyxdrmzwat5mebtf9eio.png b/vignettes/tinytable_assets/idtyxdrmzwat5mebtf9eio.png new file mode 100644 index 00000000..bfc66e8f Binary files /dev/null and b/vignettes/tinytable_assets/idtyxdrmzwat5mebtf9eio.png differ diff --git a/vignettes/tinytable_assets/idw4pm1kquu06a8tzesmuq.png b/vignettes/tinytable_assets/idw4pm1kquu06a8tzesmuq.png new file mode 100644 index 00000000..0e9656bb Binary files /dev/null and b/vignettes/tinytable_assets/idw4pm1kquu06a8tzesmuq.png differ diff --git a/vignettes/tinytable_assets/idwtepbv2i1y1cjbbed7wd.png b/vignettes/tinytable_assets/idwtepbv2i1y1cjbbed7wd.png new file mode 100644 index 00000000..b6cc9f62 Binary files /dev/null and b/vignettes/tinytable_assets/idwtepbv2i1y1cjbbed7wd.png differ diff --git a/vignettes/tinytable_assets/idwvmctulxr76uoxw2phn7.png b/vignettes/tinytable_assets/idwvmctulxr76uoxw2phn7.png new file mode 100644 index 00000000..ad809c1c Binary files /dev/null and b/vignettes/tinytable_assets/idwvmctulxr76uoxw2phn7.png differ diff --git a/vignettes/tinytable_assets/idx46cyra1amgs7994nxgu.png b/vignettes/tinytable_assets/idx46cyra1amgs7994nxgu.png new file mode 100644 index 00000000..d7222e0f Binary files /dev/null and b/vignettes/tinytable_assets/idx46cyra1amgs7994nxgu.png differ diff --git a/vignettes/tinytable_assets/idy8r73twqxnikwd8tqxbd.png b/vignettes/tinytable_assets/idy8r73twqxnikwd8tqxbd.png new file mode 100644 index 00000000..2a3649f8 Binary files /dev/null and b/vignettes/tinytable_assets/idy8r73twqxnikwd8tqxbd.png differ diff --git a/vignettes/tutorial.html b/vignettes/tutorial.html index 2177444b..6df0abc4 100644 --- a/vignettes/tutorial.html +++ b/vignettes/tutorial.html @@ -251,30 +251,33 @@

On this page

-
  • Groups and labels +
  • Groups and labels: group_tt() -
    -

    Tiny Tables

    +
    +

    Tiny Tables: tt()

    Load the library and set some global options:

    library(tinytable)
    @@ -357,9 +360,9 @@ 

    Tiny Tables

    - tinytable_y8u50qp44b9nzxjjjp2t + tinytable_bg123fjsemjj3zc08n46 @@ -377,7 +380,7 @@

    Tiny Tables

    -
  • Data about cars.
    +
    @@ -423,12 +426,12 @@

    Tiny Tables

    @@ -448,96 +451,20 @@

    Tiny Tables

    -
    -

    Output formats

    -

    tinytable can produce tables in HTML, Word, Markdown, LaTeX, 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:

    -
    -
    tt(x) |> print("markdown")
    -tt(x) |> print("html")
    -tt(x) |> print("latex")
    -
    -options(tinytable_print_output = "markdown")
    -
    -

    With 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.):

    -
    tt(x) |> save_tt("path/to/file.png")
    -tt(x) |> save_tt("path/to/file.pdf")
    -tt(x) |> save_tt("path/to/file.docx")
    -tt(x) |> save_tt("path/to/file.html")
    -tt(x) |> save_tt("path/to/file.tex")
    -tt(x) |> save_tt("path/to/file.md")
    -

    save_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.

    -
    -
    tt(mtcars[1:10, 1:5]) |>
    -  group_tt(
    -    i = list(
    -      "Hello" = 3,
    -      "World" = 8),
    -    j = list(
    -      "Foo" = 2:3,
    -      "Bar" = 4:5)) |>
    -  print("markdown")
    -
    -
    
    -+------+-------------+------------+
    -|      | Foo         | Bar        |
    -+------+-----+-------+-----+------+
    -| mpg  | cyl | disp  | hp  | drat |
    -+======+=====+=======+=====+======+
    -| 21   | 6   | 160   | 110 | 3.9  |
    -+------+-----+-------+-----+------+
    -| 21   | 6   | 160   | 110 | 3.9  |
    -+------+-----+-------+-----+------+
    -| Hello                           |
    -+------+-----+-------+-----+------+
    -| 22.8 | 4   | 108   | 93  | 3.85 |
    -+------+-----+-------+-----+------+
    -| 21.4 | 6   | 258   | 110 | 3.08 |
    -+------+-----+-------+-----+------+
    -| 18.7 | 8   | 360   | 175 | 3.15 |
    -+------+-----+-------+-----+------+
    -| 18.1 | 6   | 225   | 105 | 2.76 |
    -+------+-----+-------+-----+------+
    -| 14.3 | 8   | 360   | 245 | 3.21 |
    -+------+-----+-------+-----+------+
    -| World                           |
    -+------+-----+-------+-----+------+
    -| 24.4 | 4   | 146.7 | 62  | 3.69 |
    -+------+-----+-------+-----+------+
    -| 22.8 | 4   | 140.8 | 95  | 3.92 |
    -+------+-----+-------+-----+------+
    -| 19.2 | 6   | 167.6 | 123 | 3.92 |
    -+------+-----+-------+-----+------+
    -
    -
    -
    -
    tt(mtcars[1:10, 1:5]) |>
    -  group_tt(
    -    i = list(
    -      "Hello" = 3,
    -      "World" = 8),
    -    j = list(
    -      "Foo" = 2:3,
    -      "Bar" = 4:5)) |>
    -  save_tt("markdown")
    -
    -
    [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   | 146.7 | 62  | 3.69 |\n+------+-----+-------+-----+------+\n| 22.8 | 4   | 140.8 | 95  | 3.92 |\n+------+-----+-------+-----+------+\n| 19.2 | 6   | 167.6 | 123 | 3.92 |\n+------+-----+-------+-----+------+"
    -
    -
    -

    Themes

    tinytable offers a few basic themes out of the box: “default”, “striped”, “bootstrap”, “grid”, “void.” Those themes can be applied with the theme argument of the tt() function. As we will see below, it is easy to go much beyond those basic settings to customize your own tables. Here we only illustrate a few of the simplest settings:

    -
    tt(x, theme = "striped")
    +
    tt(x, theme = "striped")
    - tinytable_hiyjjqe1qlv1wiigdg1z + tinytable_l8f2wk1bq373aeanv9om @@ -555,7 +482,7 @@

    Themes

    -
    +
    @@ -601,12 +528,12 @@

    Themes

    @@ -642,16 +569,16 @@

    Themes

    -
    tt(x, theme = "grid")
    +
    tt(x, theme = "grid")
    - tinytable_t1fy4gtin8vn5egilf3d + tinytable_6rn9mctzlzwkhd1olybm @@ -669,7 +596,7 @@

    Themes

    -
    +
    @@ -715,12 +642,12 @@

    Themes

    @@ -756,16 +683,16 @@

    Themes

    -
    tt(x, theme = "bootstrap")
    +
    tt(x, theme = "bootstrap")
    - tinytable_mgkzn9vb0arh7vr0uit7 + tinytable_rmixurrdryvbj7shytwb @@ -783,7 +710,7 @@

    Themes

    -
    +
    @@ -829,12 +756,12 @@

    Themes

    @@ -870,26 +797,20 @@

    Themes

    -
    -

    Alignment

    -

    To align columns, we use a single character, or a string where each letter represents a column:

    +
    +

    Width

    +

    The width arguments accepts a number between 0 and 1, indicating what proportion of the linewidth the table should cover:

    -
    dat <- data.frame(
    -  a = c("a", "aa", "aaa"),
    -  b = c("b", "bb", "bbb"),
    -  c = c("c", "cc", "ccc"))
    -
    -tt(dat) |> style_tt(j = 1:3, align = "c")
    +
    tt(x, width = 0.5)
    - tinytable_ghu1fmkqwq43vsgsfqfy + tinytable_5cthvq6k97urueuavt0v @@ -907,138 +828,58 @@

    Alignment

    -
    +
    - - - + + + + + - - - - - - - - + + + + + - - - - - -
    abcmpgcyldisphpdrat
    abc
    aabbcc2161601103.9
    aaabbbccc
    -
    - - - - - - - -
    tt(dat) |> style_tt(j = 1:3, align = "lcr")
    -
    - - - - - - tinytable_ulhrdw03vg2d9ev18bg6 - - - - - - - -
    - - - - - - - - - - - - - - - + + + + + - - - + + + + + - - - + + + + +
    abc
    abc2161601103.9
    aabbcc22.84108933.85
    aaabbbccc21.462581103.08
    @@ -1068,28 +899,17 @@

    Alignment

    - -
    -

    Formatting (numbers, dates, strings, etc.)

    -

    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.

    -

    In a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():

    -
    dat <- data.frame(
    -     w = c(143002.2092, 201399.181, 100188.3883),
    -     x = c(1.43402, 201.399, 0.134588),
    -     y = as.Date(sample(1:1000, 3)),
    -     z = c(TRUE, TRUE, FALSE))
    -
    -tt(dat, digits = 2)
    +
    tt(x, width = 1)
    - tinytable_otjlh1vsr4wc97pdv7eu + tinytable_zs61ffpauk2rf8zk8f86 @@ -1107,145 +927,58 @@

    Form
    - +
    - - - - + + + + + - - - - - - - - - - + + + + + - - - - - - -
    wxyzmpgcyldisphpdrat
    143002 1.431972-09-16True
    201399201.401970-11-16True2161601103.9
    100188 0.131970-06-04False
    -
    - - - - - - -

    -
    -

    We can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:

    -
    -
    tt(dat) |>
    -  format_tt(
    -    j = 2:4,
    -    digits = 1,
    -    date = "%B %d %Y") |>
    -  format_tt(
    -    j = 1,
    -    digits = 2,
    -    num_mark_big = " ",
    -    num_mark_dec = ",",
    -    num_fmt = "decimal")
    -
    - - - - - - tinytable_f34iqa8wsklp5lyzbbk3 - - - - - - - -
    - - - - - - - - - - - - - - - - - + + + + + - - - - + + + + + - - - - + + + + +
    wxyz
    143 002,21 1.4September 16 1972True2161601103.9
    201 399,18201.4November 16 1970True22.84108933.85
    100 188,39 0.1June 04 1970False21.462581103.08
    @@ -1264,25 +998,38 @@

    Form

    -

    We 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):

    +
    +
    +

    Captions and cross-references

    +

    In Quarto, one can specify captions and use cross-references using code like this:

    +
    @tbl-blah shows that...
    +
    +```{r}
    +#| label: tbl-blah
    +#| tbl-cap: "Blah blah blah"
    +library(tinytable)
    +tt(mtcars[1:4, 1:4])
    +```
    +

    And here is the rendered version of the code chunk above:

    +

    Table 1 shows that…

    -
    dat <- data.frame(
    -     a = c("Burger", "Halloumi", "Tofu", "Beans"),
    -     b = c(1.43202, 201.399, 0.146188, 0.0031),
    -     c = c(98938272783457, 7288839482, 29111727, 93945))
    -tt(dat) |>
    -  format_tt(j = "a", sprintf = "Food: %s") |>
    -  format_tt(j = 2, digits = 1) |>
    -  format_tt(j = "c", digits = 2, num_suffix = TRUE)
    +
    library(tinytable)
    +tt(mtcars[1:4, 1:4], placement = NULL)
    +
    +
    +
    +Table 1: Blah blah blah +
    +
    - tinytable_8erslhcdbkpaonxiweje + tinytable_thdlpxw5ybgtxx701i4l @@ -1300,48 +1047,53 @@

    Form
    - +
    - - - + + + + - - - + + + + - - - + + + + - - - + + + + - - - + + + +
    abcmpgcyldisphp
    Food: Burger 1.43298.94T216160110
    Food: Halloumi201.3997.29B216160110
    Food: Tofu 0.14629.11M22.8410893
    Food: Beans 0.00393.94K21.46258110
    @@ -1359,36 +1112,36 @@

    Form

    -

    Finally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:

    -
    -
    format_tt(pi, digits = 1)
    -
    -
    [1] "3"
    +
    -
    format_tt(dat, digits = 1, num_suffix = TRUE)
    -
    -
             a     b     c
    -1   Burger   1.4 98.9T
    -2 Halloumi 201.4  7.3B
    -3     Tofu   0.1 29.1M
    -4    Beans   0.0 93.9K
    +

    For standalone LaTeX tables, you can use the caption argument like so:

    +
    +
    tt(x, caption = "Blah blah.\\label{tbl-blah}")
    +

    Be aware that this more approach may not work well in Quarto or Rmarkdown documents.

    -
    -

    Width

    -

    The width arguments accepts a number between 0 and 1, indicating what proportion of the linewidth the table should cover:

    +
    +

    Footnotes

    +

    The notes argument accepts single strings or named lists of strings:

    -
    tt(x, width = 0.5)
    +
    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."
    +
    +lorem <- data.frame(
    +  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.",
    +  Ipsum = " Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos."
    +)
    +
    +tt(lorem, notes = n, width = 1)
    - tinytable_ajbbpkzqao1eqdzzrbc0 + tinytable_mrkxs5cc5xae6f6ooego @@ -1406,58 +1159,31 @@

    Width

    - +
    - - - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + +

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

    mpgcyldisphpdratLoremIpsum
    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.
    2161601103.9
    2161601103.9
    22.84108933.85
    21.462581103.08Sed 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. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.
    @@ -1477,17 +1200,18 @@

    Width

    +

    When notes is a named list, the names are used as identifiers and displayed as superscripts:

    -
    tt(x, width = 1)
    +
    tt(x, notes = list(a = "Blah.", b = "Blah blah."))
    - tinytable_aft1cs5iydpwrbsf274n + tinytable_v70c60ukdimviirw7kc8 @@ -1505,7 +1229,7 @@

    Width

    - +
    @@ -1516,7 +1240,8 @@

    Width

    - + + @@ -1551,12 +1276,12 @@

    Width

    @@ -1581,20 +1306,16 @@

    Width

    Line breaks and text wrapping

    When the width argument is specified and a cell includes long text, the text is automatically wrapped to match the table.

    -
    lorem <- data.frame(
    -  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.",
    -  Ipsum = " Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos."
    -)
    -tt(lorem, width = 3/4)
    +
    tt(lorem, width = 3/4)
    - tinytable_f331y4dmybh0r0q7cudi + tinytable_qbegz2p3tedwd7l23o58 @@ -1612,7 +1333,7 @@

    Line breaks
    -

    drat
    a Blah.
    b Blah blah.
    21
    +

    A full width table with wrapped text.

    @@ -1631,12 +1352,12 @@

    Line breaks @@ -1655,20 +1376,20 @@

    Line breaks

    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: \\\\

    -
    d <- data.frame(
    -  "{Sed ut \\\\ perspiciatis unde}",
    -  "dicta sunt<br> explicabo. Nemo"
    -) |> setNames(c("LaTeX line break", "HTML line break"))
    -tt(d, width = 1)
    +
    d <- data.frame(
    +  "{Sed ut \\\\ perspiciatis unde}",
    +  "dicta sunt<br> explicabo. Nemo"
    +) |> setNames(c("LaTeX line break", "HTML line break"))
    +tt(d, width = 1)
    - tinytable_zn31yzac3dutfjr2kqk6 + tinytable_xw1m576f763umf7fsc12 @@ -1686,7 +1407,7 @@

    Line breaks
    -

    A full width table with wrapped text.

    +
    @@ -1705,12 +1426,12 @@

    Line breaks @@ -1728,37 +1449,25 @@

    Line breaks -
    -

    Captions and cross-references

    -

    In Quarto, one can specify captions and use cross-references using code like this:

    -
    @tbl-blah shows that...
    -
    -```{r}
    -#| label: tbl-blah
    -#| tbl-cap: "Blah blah blah"
    -library(tinytable)
    -tt(mtcars[1:4, 1:4])
    -```
    -

    And here is the rendered version of the code chunk above:

    -

    Table 1 shows that…

    +
    +

    Math

    +

    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.

    -
    library(tinytable)
    -tt(mtcars[1:4, 1:4], placement = NULL)
    -
    -
    -
    -Table 1: Blah blah blah -
    -
    +
    dat <- data.frame(Math = c(
    +  "$x^2 + y^2 = z^2$",
    +  "$\\frac{1}{2}$"
    +))
    +tt(dat) |> style_tt(j = 1, align = "c")
    - tinytable_7nwz2rn468b4yuc7t94j + tinytable_xnoh0l1oey8t6nbsjz95 @@ -1776,53 +1485,32 @@

    Captions and
    -

    +
    - - - - + - - - - - - - - - - - - - - - - + - - - - +
    mpgcyldisphpMath
    216160110
    216160110
    22.8410893$x^2 + y^2 = z^2$
    21.46258110$\frac{1}{2}$
    @@ -1841,31 +1529,107 @@

    Captions and

    - +
    +
    +
    +

    Output formats: save_tt()

    +

    tinytable can produce tables in HTML, Word, Markdown, LaTeX, 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:

    +
    +
    tt(x) |> print("markdown")
    +tt(x) |> print("html")
    +tt(x) |> print("latex")
    +
    +options(tinytable_print_output = "markdown")
    +
    +

    With 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.):

    +
    tt(x) |> save_tt("path/to/file.png")
    +tt(x) |> save_tt("path/to/file.pdf")
    +tt(x) |> save_tt("path/to/file.docx")
    +tt(x) |> save_tt("path/to/file.html")
    +tt(x) |> save_tt("path/to/file.tex")
    +tt(x) |> save_tt("path/to/file.md")
    +

    save_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.

    +
    +
    tt(mtcars[1:10, 1:5]) |>
    +  group_tt(
    +    i = list(
    +      "Hello" = 3,
    +      "World" = 8),
    +    j = list(
    +      "Foo" = 2:3,
    +      "Bar" = 4:5)) |>
    +  print("markdown")
    +
    +
    
    ++------+-------------+------------+
    +|      | Foo         | Bar        |
    ++------+-----+-------+-----+------+
    +| mpg  | cyl | disp  | hp  | drat |
    ++======+=====+=======+=====+======+
    +| 21   | 6   | 160   | 110 | 3.9  |
    ++------+-----+-------+-----+------+
    +| 21   | 6   | 160   | 110 | 3.9  |
    ++------+-----+-------+-----+------+
    +| Hello                           |
    ++------+-----+-------+-----+------+
    +| 22.8 | 4   | 108   | 93  | 3.85 |
    ++------+-----+-------+-----+------+
    +| 21.4 | 6   | 258   | 110 | 3.08 |
    ++------+-----+-------+-----+------+
    +| 18.7 | 8   | 360   | 175 | 3.15 |
    ++------+-----+-------+-----+------+
    +| 18.1 | 6   | 225   | 105 | 2.76 |
    ++------+-----+-------+-----+------+
    +| 14.3 | 8   | 360   | 245 | 3.21 |
    ++------+-----+-------+-----+------+
    +| World                           |
    ++------+-----+-------+-----+------+
    +| 24.4 | 4   | 146.7 | 62  | 3.69 |
    ++------+-----+-------+-----+------+
    +| 22.8 | 4   | 140.8 | 95  | 3.92 |
    ++------+-----+-------+-----+------+
    +| 19.2 | 6   | 167.6 | 123 | 3.92 |
    ++------+-----+-------+-----+------+
    -

    For standalone LaTeX tables, you can use the caption argument like so:

    -
    tt(x, caption = "Blah blah.\\label{tbl-blah}")
    +
    tt(mtcars[1:10, 1:5]) |>
    +  group_tt(
    +    i = list(
    +      "Hello" = 3,
    +      "World" = 8),
    +    j = list(
    +      "Foo" = 2:3,
    +      "Bar" = 4:5)) |>
    +  save_tt("markdown")
    +
    +
    [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   | 146.7 | 62  | 3.69 |\n+------+-----+-------+-----+------+\n| 22.8 | 4   | 140.8 | 95  | 3.92 |\n+------+-----+-------+-----+------+\n| 19.2 | 6   | 167.6 | 123 | 3.92 |\n+------+-----+-------+-----+------+"
    +
    -

    Be aware that this more approach may not work well in Quarto or Rmarkdown documents.

    -
    -

    Footnotes

    -

    The notes argument accepts single strings or named lists of strings:

    +
    +

    Formatting content: format_tt()

    +
    +

    Numbers, dates, strings, etc.

    +

    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.

    +

    In a very simple case—such as printing 2 significant digits of all numeric variables—we can use the digits argument of tt():

    -
    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."
    -
    -tt(lorem, notes = n, width = 1)
    +
    dat <- data.frame(
    +     w = c(143002.2092, 201399.181, 100188.3883),
    +     x = c(1.43402, 201.399, 0.134588),
    +     y = as.Date(sample(1:1000, 3)),
    +     z = c(TRUE, TRUE, FALSE))
    +
    +tt(dat, digits = 2)
    - tinytable_3mjl6w7074z2662hoajk + tinytable_9l6jql857lenqoypv2n5 @@ -1883,31 +1647,47 @@

    Footnotes

    - +

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

    - - + + + + - + - - + + + + + + + + + + + + + + + +
    LoremIpsumwxyz
    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.
    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. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos.143002 1.431971-01-13True
    201399201.401972-07-13True
    100188 0.131970-03-03False
    @@ -1924,18 +1706,28 @@

    Footnotes

    -

    When notes is a named list, the names are used as identifiers and displayed as superscripts:

    +

    We can get more fine-grained control over formatting by calling format_tt() after tt(), optionally by specifying the columns to format with j:

    -
    tt(x, notes = list(a = "Blah.", b = "Blah blah."))
    +
    tt(dat) |>
    +  format_tt(
    +    j = 2:4,
    +    digits = 1,
    +    date = "%B %d %Y") |>
    +  format_tt(
    +    j = 1,
    +    digits = 2,
    +    num_mark_big = " ",
    +    num_mark_dec = ",",
    +    num_fmt = "decimal")
    - tinytable_g7kcqtks5nwr697n1vm7 + tinytable_mfqjwewhfuhy9mhynvas @@ -1953,59 +1745,47 @@

    Footnotes

    - +
    - - - - - + + + + - - + - - - - - - - - - - - - + + + + - - - - - + + + + - - - - - + + + +
    mpgcyldisphpdratwxyz
    a Blah.
    b Blah blah.
    2161601103.9
    2161601103.9143 002,21 1.4January 13 1971True
    22.84108933.85201 399,18201.4July 13 1972True
    21.462581103.08100 188,39 0.1March 03 1970False
    @@ -2025,26 +1804,25 @@

    Footnotes

    -
    -
    -

    Math

    -

    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.

    +

    We 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):

    -
    dat <- data.frame(Math = c(
    -  "$x^2 + y^2 = z^2$",
    -  "$\\frac{1}{2}$"
    -))
    -tt(dat) |> style_tt(j = 1, align = "c")
    +
    dat <- data.frame(
    +     a = c("Burger", "Halloumi", "Tofu", "Beans"),
    +     b = c(1.43202, 201.399, 0.146188, 0.0031),
    +     c = c(98938272783457, 7288839482, 29111727, 93945))
    +tt(dat) |>
    +  format_tt(j = "a", sprintf = "Food: %s") |>
    +  format_tt(j = 2, digits = 1) |>
    +  format_tt(j = "c", digits = 2, num_suffix = TRUE)
    - tinytable_z02lq1f30t09kw4qlgc8 + tinytable_ekkuagw1mkyz6qvj79er @@ -2062,32 +1840,48 @@

    Math

    - +
    - + + + - + + + - + + + + + + + + + + + + +
    Mathabc
    $x^2 + y^2 = z^2$Food: Burger 1.43298.94T
    $\frac{1}{2}$Food: Halloumi201.3997.29B
    Food: Tofu 0.14629.11M
    Food: Beans 0.00393.94K
    +
    +
    +

    Finally, if you like the format_tt() interface, you can use it directly with numbers, vectors, or data frames:

    +
    +
    format_tt(pi, digits = 1)
    +
    +
    [1] "3"
    +
    +
    format_tt(dat, digits = 1, num_suffix = TRUE)
    +
    +
             a     b     c
    +1   Burger   1.4 98.9T
    +2 Halloumi 201.4  7.3B
    +3     Tofu   0.1 29.1M
    +4    Beans   0.0 93.9K
    @@ -2111,24 +1919,24 @@

    Math

    Markdown

    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).

    -
    dat <- data.frame( markdown = c(
    -  "This is _italic_ text.",
    -  "This sentence ends with a superscript.^2^")
    -)
    -
    -tt(dat) |>
    -  format_tt(j = 1, markdown = TRUE) |>
    -  style_tt(j = 1, align = "c")
    +
    dat <- data.frame( markdown = c(
    +  "This is _italic_ text.",
    +  "This sentence ends with a superscript.^2^")
    +)
    +
    +tt(dat) |>
    +  format_tt(j = 1, markdown = TRUE) |>
    +  style_tt(j = 1, align = "c")
    - tinytable_stt52p2lsnhvxdu158n2 + tinytable_oi7gg8skpyvwg6542jb0 @@ -2146,7 +1954,7 @@

    Markdown

    - +
    @@ -2166,12 +1974,12 @@

    Markdown

    @@ -2192,46 +2000,46 @@

    Markdown

    Markdown syntax can be particularly useful when formatting URLs in a table:

    -
    dat <- data.frame(
    -  `Package (link)` = c(
    -    "[`marginaleffects`](https://www.marginaleffects.com/)",
    -    "[`modelsummary`](https://www.modelsummary.com/)",
    -    "[`tinytable`](https://vincentarelbundock.github.io/tinytable/)",
    -    "[`countrycode`](https://vincentarelbundock.github.io/countrycode/)",
    -    "[`WDI`](https://vincentarelbundock.github.io/WDI/)",
    -    "[`softbib`](https://vincentarelbundock.github.io/softbib/)",
    -    "[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)",
    -    "[`altdoc`](https://etiennebacher.github.io/altdoc/)",
    -    "[`plot2`](https://grantmcdermott.com/plot2/)",
    -    "[`parameters`](https://easystats.github.io/parameters/)",
    -    "[`insight`](https://easystats.github.io/insight/)"
    -  ),
    -  Purpose = c(
    -    "Interpreting statistical models",
    -    "Data and model summaries",
    -    "Draw beautiful tables easily",
    -    "Convert country codes and names",
    -    "Download data from the World Bank",
    -    "Software bibliographies in R",
    -    "Snapshots for unit tests using `tinytest`",
    -    "Create documentation website for R packages",
    -    "Extension of base R plot functions",
    -    "Extract from model objects",
    -    "Extract information from model objects"
    -  ),
    -  check.names = FALSE
    -)
    -
    -tt(dat) |> format_tt(j = 1, markdown = TRUE)
    +
    dat <- data.frame(
    +  `Package (link)` = c(
    +    "[`marginaleffects`](https://www.marginaleffects.com/)",
    +    "[`modelsummary`](https://www.modelsummary.com/)",
    +    "[`tinytable`](https://vincentarelbundock.github.io/tinytable/)",
    +    "[`countrycode`](https://vincentarelbundock.github.io/countrycode/)",
    +    "[`WDI`](https://vincentarelbundock.github.io/WDI/)",
    +    "[`softbib`](https://vincentarelbundock.github.io/softbib/)",
    +    "[`tinysnapshot`](https://vincentarelbundock.github.io/tinysnapshot/)",
    +    "[`altdoc`](https://etiennebacher.github.io/altdoc/)",
    +    "[`plot2`](https://grantmcdermott.com/plot2/)",
    +    "[`parameters`](https://easystats.github.io/parameters/)",
    +    "[`insight`](https://easystats.github.io/insight/)"
    +  ),
    +  Purpose = c(
    +    "Interpreting statistical models",
    +    "Data and model summaries",
    +    "Draw beautiful tables easily",
    +    "Convert country codes and names",
    +    "Download data from the World Bank",
    +    "Software bibliographies in R",
    +    "Snapshots for unit tests using `tinytest`",
    +    "Create documentation website for R packages",
    +    "Extension of base R plot functions",
    +    "Extract from model objects",
    +    "Extract information from model objects"
    +  ),
    +  check.names = FALSE
    +)
    +
    +tt(dat) |> format_tt(j = 1, markdown = TRUE)
    - tinytable_ejtw704nzfx22k9f2wji + tinytable_a4aov2lb3j9beb8g6mku @@ -2249,7 +2057,7 @@

    Markdown

    -
    +

    Vincent sometimes contributes to these R packages.

    @@ -2308,12 +2116,12 @@

    Markdown

    @@ -2332,8 +2140,8 @@

    Markdown

    -
    -

    Style

    +
    +

    Style: style_tt()

    The main styling function for the tinytable package is style_tt(). Via this function, you can access three main interfaces to customize tables:

    1. A 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.
    2. @@ -2360,22 +2168,22 @@

      Style

      Cells, rows, columns

      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:

      -
      tt(x) |>
      -  style_tt(
      -    i = 2,
      -    j = 3,
      -    background = "black",
      -    color = "white")
      +
      tt(x) |>
      +  style_tt(
      +    i = 2,
      +    j = 3,
      +    background = "black",
      +    color = "white")
      - tinytable_mcc67y9zhoczbtl35lq7 + tinytable_ryxwvh24zyyfbb1imbgd @@ -2393,7 +2201,7 @@

      Cells, rows, columns -

    Vincent sometimes contributes to these R packages.

    +
    @@ -2439,12 +2247,12 @@

    Cells, rows, columns @@ -2467,22 +2275,22 @@

    Cells, rows, columns

    The i and j accept vectors of integers to modify several cells at once:

    -
    tt(x) |>
    -  style_tt(
    -    i = 2:3,
    -    j = c(1, 3, 4),
    -    italic = TRUE,
    -    color = "orange")
    +
    tt(x) |>
    +  style_tt(
    +    i = 2:3,
    +    j = c(1, 3, 4),
    +    italic = TRUE,
    +    color = "orange")
    - tinytable_0hdjvpthwz0c83twxdr9 + tinytable_4skaf7admzeg85a4c97w @@ -2500,7 +2308,7 @@

    Cells, rows, columns -

    +
    @@ -2546,12 +2354,12 @@

    Cells, rows, columns @@ -2579,17 +2387,17 @@

    Cells, rows, columns

    We can style all cells in a table by omitting both the i and j arguments:

    -
    tt(x) |> style_tt(color = "orange")
    +
    tt(x) |> style_tt(color = "orange")
    - tinytable_a7decaxcd2wcj78t06q3 + tinytable_bhl6rvelig1tskm1o6tz @@ -2607,7 +2415,7 @@

    Cells, rows, columns -

    +
    @@ -2653,12 +2461,12 @@

    Cells, rows, columns @@ -2700,17 +2508,17 @@

    Cells, rows, columns

    We can style entire rows by omitting the j argument:

    -
    tt(x) |> style_tt(i = 1:2, color = "orange")
    +
    tt(x) |> style_tt(i = 1:2, color = "orange")
    - tinytable_stk1xvg022v8kba2jetz + tinytable_xc1sep3h6a4loxt8ofcd @@ -2728,7 +2536,7 @@

    Cells, rows, columns -

    +
    @@ -2774,12 +2582,12 @@

    Cells, rows, columns @@ -2811,17 +2619,17 @@

    Cells, rows, columns

    We can style entire columns by omitting the i argument:

    -
    tt(x) |> style_tt(j = c(2, 4), bold = TRUE)
    +
    tt(x) |> style_tt(j = c(2, 4), bold = TRUE)
    - tinytable_vmpvvwg787pau5ed9vsk + tinytable_6r517hmi6d335sut28we @@ -2839,7 +2647,7 @@

    Cells, rows, columns -

    +
    @@ -2885,12 +2693,12 @@

    Cells, rows, columns @@ -2922,17 +2730,17 @@

    Cells, rows, columns

    The j argument accepts integer vectors, but also a string with a Perl-style regular expression, which makes it easier to select columns by name:

    -
    tt(x) |> style_tt(j = "mpg|drat", color = "orange")
    +
    tt(x) |> style_tt(j = "mpg|drat", color = "orange")
    - tinytable_w5orkop93jgc2stmhq5k + tinytable_et9pzdl5om5xdoo38h2y @@ -2950,7 +2758,7 @@

    Cells, rows, columns -

    +
    @@ -2996,12 +2804,12 @@

    Cells, rows, columns @@ -3033,20 +2841,20 @@

    Cells, rows, columns

    Of course, we can also call the style_tt() function several times to apply different styles to different parts of the table:

    -
    tt(x) |> 
    -  style_tt(i = 1, j = 1:2, color = "orange") |>
    -  style_tt(i = 1, j = 3:4, color = "green")
    +
    tt(x) |> 
    +  style_tt(i = 1, j = 1:2, color = "orange") |>
    +  style_tt(i = 1, j = 3:4, color = "green")
    - tinytable_ar9qd45jijti9nxkzbl2 + tinytable_a8xfr4m7ju9blqjhhmqe @@ -3064,7 +2872,7 @@

    Cells, rows, columns -

    +
    @@ -3110,12 +2918,12 @@

    Cells, rows, columns @@ -3157,17 +2965,17 @@

    Colors

    Note that the keywords used in LaTeX and HTML are slightly different.

    -
    tt(x) |> style_tt(i = 1:4, j = 1, color = "#FF5733")
    +
    tt(x) |> style_tt(i = 1:4, j = 1, color = "#FF5733")
    - tinytable_f940w5uyr11msudkrfi3 + tinytable_lmicvbmhzqoffnl6snxm @@ -3185,7 +2993,7 @@

    Colors

    -
    +
    @@ -3231,12 +3039,12 @@

    Colors

    @@ -3262,6 +3070,205 @@

    Colors

    Note that when using Hex codes in a LaTeX table, we need extra declarations in the LaTeX preamble. See ?tt for details.

    +
    +

    Alignment

    +

    To align columns, we use a single character, or a string where each letter represents a column:

    +
    +
    dat <- data.frame(
    +  a = c("a", "aa", "aaa"),
    +  b = c("b", "bb", "bbb"),
    +  c = c("c", "cc", "ccc"))
    +
    +tt(dat) |> style_tt(j = 1:3, align = "c")
    +
    + + + + + + tinytable_ky3q1cbo1bn9avf423no + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    abc
    abc
    aabbcc
    aaabbbccc
    +
    + + + + + + +
    +
    tt(dat) |> style_tt(j = 1:3, align = "lcr")
    +
    + + + + + + tinytable_yekdcq0a1gknz3qg57ai + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    abc
    abc
    aabbcc
    aaabbbccc
    +
    + + + + + + +
    +
    +

    Fonts

    The font size is specified in em units.

    @@ -3273,10 +3280,10 @@

    Fonts

    - tinytable_ohelvt1iyhsrvipiomkl + tinytable_myxo7ly1a0ey9hr0wnek @@ -3294,7 +3301,7 @@

    Fonts

    - +
    @@ -3340,12 +3347,12 @@

    Fonts

    @@ -3389,9 +3396,9 @@

    Headers

    - tinytable_ripj208ouuypt1wvwlu7 + tinytable_u550veqwwrrawb75squ2 @@ -3409,7 +3416,7 @@

    Headers

    -
    +
    @@ -3448,12 +3455,12 @@

    Headers

    @@ -3482,10 +3489,10 @@

    Headers

    - tinytable_lvwrfm9oo3mhm01jvjtb + tinytable_napy0tzqhwsg49ybmv75 @@ -3503,7 +3510,7 @@

    Headers

    -
    +
    @@ -3549,12 +3556,12 @@

    Headers

    @@ -3588,10 +3595,10 @@

    Headers

    - tinytable_trq2sd4nwr58hay8jxhd + tinytable_gj7amndve79wox5t7yxi @@ -3609,7 +3616,7 @@

    Headers

    -
    +
    @@ -3655,12 +3662,12 @@

    Headers

    @@ -3708,10 +3715,10 @@

    Conditional styling - tinytable_8s59n89kozhipfkmj0n7 + tinytable_1s55fhvo85fds8iti1uh @@ -3729,7 +3736,7 @@

    Conditional styling -

    +
    @@ -3795,12 +3802,12 @@

    Conditional styling @@ -3842,13 +3849,13 @@

    Vectorized sty - tinytable_w9s67lnjkaxhxpf2mi7e + tinytable_y4we0jlzq13dfh59v1tv @@ -3866,7 +3873,7 @@

    Vectorized sty
    -

    +
    @@ -3912,12 +3919,12 @@

    Vectorized sty @@ -3970,11 +3977,11 @@

    Vectorized sty - tinytable_m9gztozqi3hdshq5rl37 + tinytable_fov7hgr4fphsh6rocnve @@ -3992,7 +3999,7 @@

    Vectorized sty
    -

    +
    @@ -4038,12 +4045,12 @@

    Vectorized sty @@ -4101,30 +4108,30 @@

    Vectorized sty - tinytable_2rowcapqhhjjcvzerl6b + tinytable_9q1g02vn2p78lcarqo6y @@ -4142,7 +4149,7 @@

    Vectorized sty
    -

    +
    @@ -4181,12 +4188,12 @@

    Vectorized sty @@ -4292,10 +4299,10 @@

    Lines (borders)

    - tinytable_qfhs5jo3e3izc1ttja3s + tinytable_0r0s0vs362owdbgj30cj @@ -4313,7 +4320,7 @@

    Lines (borders)

    -
    +
    @@ -4359,12 +4366,12 @@

    Lines (borders)

    @@ -4423,12 +4430,12 @@

    Lines (borders)

    - tinytable_je8oummvitcvhvcrmu84 + tinytable_7klek3ruy054dsair2sf @@ -4446,7 +4453,7 @@

    Lines (borders)

    -
    +
    @@ -4492,12 +4499,12 @@

    Lines (borders)

    @@ -4549,8 +4556,8 @@

    Lines (borders)

    -
    -

    Tiny plots and images

    +
    +

    Plots and images: plot_tt()

    The plot_tt() function can embed images and plots in a tinytable. We can insert images by specifying their paths and positions (i/j).

    Inserting images in tables

    @@ -4574,9 +4581,9 @@

    Inserting image - tinytable_td0qibt9aaqk0jtkbnmc + tinytable_ish771xwslqd459l8v4b @@ -4594,7 +4601,7 @@

    Inserting image
    -

    +
    @@ -4617,12 +4624,12 @@

    Inserting image @@ -4652,10 +4659,10 @@

    Inserting image - tinytable_w4a4ibtj5mwdqacxxj80 + tinytable_pl7co7u74up9z6ezhy2p @@ -4673,7 +4680,7 @@

    Inserting image
    -

    +
    @@ -4690,12 +4697,12 @@

    Inserting image @@ -4747,10 +4754,10 @@

    Built-in plots

    - tinytable_p0lhymkkerl49d6uhz5q + tinytable_9n3a09p3ze21nspltw9n @@ -4768,7 +4775,7 @@

    Built-in plots

    -
    +
    @@ -4782,33 +4789,33 @@

    Built-in plots

    - - - + + + - - - + + + - - - + + +
    mpg
    hp
    qsec
    @@ -4862,9 +4869,9 @@

    Custom plots: Base - tinytable_1lnssh6op3okpeaw2k0r + tinytable_r5qpf4digbmz7yytrryj @@ -4882,7 +4889,7 @@

    Custom plots: Base - +
    @@ -4894,27 +4901,27 @@

    Custom plots: Base

    - + - + - +
    mpg
    hp
    qsec
    @@ -4958,9 +4965,9 @@

    Custom plots: g - tinytable_67u4od5nr9gc7wb4h2jb + tinytable_sf9jec4lebp4plgtavoj @@ -4978,7 +4985,7 @@

    Custom plots: g
    - +
    @@ -4990,27 +4997,27 @@

    Custom plots: g

    - + - + - +
    mpg
    hp
    qsec
    @@ -5068,10 +5075,10 @@

    Custom plots: g - tinytable_a5u3cx5l2vlivnsgf8vu + tinytable_yz5ofetzw7ipgs19x6y7 @@ -5089,7 +5096,7 @@

    Custom plots: g
    - +
    @@ -5103,33 +5110,33 @@

    Custom plots: g

    - - - + + + - - - + + + - - - + + +
    Adelie
    Chinstrap
    Gentoo
    @@ -5163,8 +5170,8 @@

    Custom plots: g

    -
    -

    Groups and labels

    +
    +

    Groups and labels: group_tt()

    The group_tt() function can label groups of rows (i) or columns (j).

    Rows

    @@ -5183,11 +5190,11 @@

    Rows

    - tinytable_hny95hadq4x5fsoo0gs0 + tinytable_4fils2d2ecz24gkgkobs @@ -5205,7 +5212,7 @@

    Rows

    - +
    @@ -5316,12 +5323,12 @@

    Rows

    @@ -5384,12 +5391,12 @@

    Rows

    - tinytable_xssqb7ag1au1dkj9fl7t + tinytable_iayl31uofqkx39mturgm @@ -5407,7 +5414,7 @@

    Rows

    -
    +
    @@ -5518,12 +5525,12 @@

    Rows

    @@ -5607,9 +5614,9 @@

    Columns

    - tinytable_bdl6o4hgvjzfpqio4xqe + tinytable_3nl94vabig3gn6ax1uju @@ -5627,7 +5634,7 @@

    Columns

    -
    +
    @@ -5743,12 +5750,12 @@

    Columns

    @@ -5794,13 +5801,13 @@

    Columns

    - tinytable_gy475alkairgc7lnktxv + tinytable_szud3ofi4maenhjozohe @@ -5818,7 +5825,7 @@

    Columns

    -
    Hamburgers Halloumi
    +
    @@ -5934,12 +5941,12 @@

    Columns

    @@ -6030,10 +6037,10 @@

    Bootstrap classes

    - tinytable_hn4fhzn1gybsfgtoyl3z + tinytable_asny8o1nx2pcd5u2znv6 @@ -6051,7 +6058,7 @@

    Bootstrap classes

    -
    Hamburgers Halloumi
    +
    @@ -6097,12 +6104,12 @@

    Bootstrap classes

    @@ -6152,10 +6159,10 @@

    Bootstrap classes

    - tinytable_6i4j602g4qeu3hth8bvu + tinytable_n734w26xhlnwckicgtfl @@ -6173,7 +6180,7 @@

    Bootstrap classes

    -
    +
    @@ -6219,12 +6226,12 @@

    Bootstrap classes

    @@ -6277,10 +6284,10 @@

    CSS declarations

    - tinytable_484lw5mgfdyeg8zlr7o3 + tinytable_i3bw6bhghbxlumosel6z @@ -6298,7 +6305,7 @@

    CSS declarations

    -
    +
    @@ -6344,12 +6351,12 @@

    CSS declarations

    @@ -6423,10 +6430,10 @@

    CSS rules

    - tinytable_vbdc8q0qtpz72jxjkdem + tinytable_rqfxoy1fiabbu6vs3s0n