### Install SummaryTables Package Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/index.md Instructions for installing the SummaryTables package using Julia's Pkg manager. SummaryTables is registered in the General Registry. ```julia using Pkg Pkg.install("SummaryTables") ``` -------------------------------- ### Create a Basic Table in LaTeX Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/global_rounding/default.latex.txt This LaTeX snippet defines a complete document structure to generate a simple table. It uses `threeparttable` for potential table notes and `tabular` for column and row definitions, including examples of numerical values, scientific notation, and cells with multiple lines. `booktabs` is used for professional-looking horizontal rules. ```LaTeX \documentclass{article}\n\usepackage{threeparttable}\n\usepackage{multirow}\n\usepackage{booktabs}\n\usepackage{xcolor}\n\usepackage{tikz}\n\begin{document}\n\begin{table}[!ht]\n\setlength\tabcolsep{0pt}\n\centering\n\begin{threeparttable}\n\begin{tabular}{@{\extracolsep{2ex}}*{2}{cc}}\n\toprule\n1.41 & 1.24e7 \\\n1.06e8 & 0.00111 \\\n1.23 \\& 0.00123 & \\begin{tabular}{@{}c@{}}1.23 \\\\ 0.00123\\end{tabular} \\\n\\bottomrule\n\\end{tabular}\n\\end{threeparttable}\n\\end{table}\n\\end{document} ``` -------------------------------- ### Create a Basic Table in LaTeX Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/simple_table/three_cols_halign_left.latex.txt This LaTeX code defines a simple table using the `tabular` environment within a `threeparttable`. It includes package imports for enhanced table formatting (`booktabs`) and demonstrates basic column and row definitions with bold headers. ```LaTeX \documentclass{article}\n\usepackage{threeparttable}\n\usepackage{multirow}\n\usepackage{booktabs}\n\usepackage{xcolor}\n\usepackage{tikz}\n\begin{document}\n\begin{table}[!ht]\n\setlength\tabcolsep{0pt}\n\centering\n\begin{threeparttable}\n\begin{tabular}{@{\extracolsep{2ex}}*{3}{lll}}\n\toprule\n\textbf{value1} & \textbf{group3} & \textbf{group1} \\\n\midrule\n1 & c & a \\\n2 & c & a \\\n3 & d & a \\\n4 & d & a \\\n5 & c & b \\\n6 & c & b \\\n7 & d & b \\\n8 & d & b \\\n\bottomrule\n\end{tabular}\n\end{threeparttable}\n\end{table}\n\end{document} ``` -------------------------------- ### Generate Overview Table for a Dataset Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/overview_table.md Demonstrates the basic usage of `overview_table` to generate a statistical summary for a DataFrame, similar to R's `dfSummary`. It uses the RDatasets package to load example data. ```Julia using SummaryTables using RDatasets df = dataset("ggplot2", "diamonds") overview_table(df) ``` -------------------------------- ### Define Document-Level Relationships for Word Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/listingtable/pagination_rows=2_summarized_1.docx.txt This XML file specifies relationships within the main Word document part (document.xml), such as linking to the styles.xml file. These relationships ensure that the document can correctly reference its internal components. ```XML ``` -------------------------------- ### Define Package-Level Relationships in OpenXML Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/listingtable/pagination_rows=2_summarized_1.docx.txt This XML file defines relationships at the package level, linking the main document part (word/document.xml) to the root of the OpenXML package. It's crucial for the package to correctly locate its primary components. ```XML ``` -------------------------------- ### Create Listing Table from Various Table Types (Julia) Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/listingtable.md Illustrates the flexibility of the `listingtable` function in accepting different `Tables.jl` compatible data structures as its primary input. Examples include `DataFrame`, `NamedTuple` of `Vector`s, and `Vector` of `NamedTuple`s, all producing a basic listing table. ```Julia using DataFrames using SummaryTables data = DataFrame(value = 1:6, group1 = repeat(["A", "B", "C"], 2), group2 = repeat(["D", "E"], inner = 3)) listingtable(data, :value, rows = :group1, cols = :group2) ``` ```Julia using SummaryTables data = (; value = 1:6, group1 = repeat(["A", "B", "C"], 2), group2 = repeat(["D", "E"], inner = 3)) listingtable(data, :value, rows = :group1, cols = :group2) ``` ```Julia using SummaryTables data = [ (value = 1, group1 = "A", group2 = "D") (value = 2, group1 = "B", group2 = "D") (value = 3, group1 = "C", group2 = "D") (value = 4, group1 = "A", group2 = "E") (value = 5, group1 = "B", group2 = "E") (value = 6, group1 = "C", group2 = "E") ] listingtable(data, :value, rows = :group1, cols = :group2) ``` -------------------------------- ### Create a Listing Table with Summary Rows (Julia) Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/listingtable.md Demonstrates how to generate a listing table from a DataFrame, grouping data by specified row and column variables. Includes an example of adding row-wise summary statistics like count, mean, and standard deviation using the `summarize_rows` option. ```Julia using DataFrames using SummaryTables using Statistics data = DataFrame( concentration = [1.2, 4.5, 2.0, 1.5, 0.1, 1.8, 3.2, 1.8, 1.2, 0.2], id = repeat([1, 2], inner = 5), time = repeat([0, 0.5, 1, 2, 3], 2) ) listingtable( data, :concentration => "Concentration (ng/mL)", rows = :id => "ID", cols = :time => "Time (hr)", summarize_rows = [ length => "N", mean => "Mean", std => "SD", ] ) ``` -------------------------------- ### Define a Multi-level Header Table in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/listingtable/summarize_first_group_cols.typ.txt This snippet demonstrates how to create a complex table with nested group headers, individual column headers, and specific alignment and stroke properties using Typst's table function. It includes examples of `colspan`, `hline`, and `table.header` for advanced table layout, showcasing how to structure data with multiple levels of categorization. ```Typst #table( rows: 7, columns: 7, column-gutter: 0.25em, align: (left, center, center, right, center, center, right), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [], table.cell(colspan: 2)[*group1*], table.hline(y: 1, start: 1, end: 3, stroke: 0.75pt), [], table.cell(colspan: 2)[*group1*], table.hline(y: 1, start: 4, end: 6, stroke: 0.75pt), [], [], table.cell(colspan: 2)[a], [], table.cell(colspan: 2)[b], [], [], table.cell(colspan: 2)[*group2*], table.hline(y: 3, start: 1, end: 3, stroke: 0.75pt), [], table.cell(colspan: 2)[*group2*], table.hline(y: 3, start: 4, end: 6, stroke: 0.75pt), [], [], [e], [f], [], [e], [f], [], [*group3*], table.cell(colspan: 2)[*value1*], [*mean*], table.cell(colspan: 2)[*value1*], [*mean*], table.hline(y: 5, stroke: 0.75pt), ), [c], [1], [2], [1.5], [5], [6], [5.5], [d], [3], [4], [3.5], [7], [8], [7.5], table.hline(y: 7, stroke: 1pt), ) ``` -------------------------------- ### Define a Complex Table in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/summarytable/one_rowgroup_one_colgroup_two_summaries.typ.txt This Typst code snippet illustrates how to construct a detailed table. It specifies the number of rows and columns, column gutter, and alignment. The example demonstrates creating a multi-level header using `table.header`, merging cells with `colspan` and `rowspan`, and adding horizontal lines (`table.hline`) for visual separation. It also shows how to embed content directly within cells. ```Typst #table( rows: 7, columns: 4, column-gutter: 0.25em, align: (left, left, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [], [], table.cell(colspan: 2)[*Group 2*], table.hline(y: 1, start: 2, end: 4, stroke: 0.75pt), [], [], [e], [f], [*Group 1*], [], table.cell(colspan: 2)[*value1*], table.hline(y: 3, stroke: 0.75pt), ), table.cell(rowspan: 2)[a], [*mean*], [2], [3], [*std*], [1.41], [1.41], table.cell(rowspan: 2)[b], [*mean*], [6], [7], [*std*], [1.41], [1.41], table.hline(y: 7, stroke: 1pt), ) ``` -------------------------------- ### Create Custom Table with SummaryTables Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/index.md Demonstrates how to build a completely customizable table from scratch using `Table` and `Cell` objects. It shows how to define categories, species, fake data, and labels, then combine them into a structured table with styling metadata. ```julia using SummaryTables categories = ["Deciduous", "Deciduous", "Evergreen", "Evergreen", "Evergreen"] species = ["Beech", "Oak", "Fir", "Spruce", "Pine"] fake_data = [ "35m" "40m" "38m" "27m" "29m" "10k" "12k" "18k" "9k" "7k" "500yr" "800yr" "600yr" "700yr" "400yr" "80\$" "150\$" "40\$" "70\$" "50\$" ] labels = ["", "", "Size", Annotated("Water consumption", "Liters per year"), "Age", "Value"] body = [ Cell.(categories, bold = true, merge = true, border_bottom = true)'; Cell.(species)'; Cell.(fake_data) ] Table(hcat( Cell.(labels, italic = true, halign = :right), body ), header = 2) ``` -------------------------------- ### Define a Multi-Row and Multi-Column Header Table in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/listingtable/pagination_rows=1_cols=2_4.typ.txt This snippet demonstrates how to create a complex table layout in Typst, featuring multiple header rows with merged cells (colspan), custom column gutters, alignment, and various stroke styles for horizontal lines. It showcases nested `table.header` elements to structure grouped headers, providing a robust example for advanced table design. ```Typst #table( rows: 6, columns: 3, column-gutter: 0.25em, align: (left, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [], table.cell(colspan: 2)[*group1*], table.hline(y: 1, start: 1, end: 3, stroke: 0.75pt), [], table.cell(colspan: 2)[b], [], table.cell(colspan: 2)[*group2*], table.hline(y: 3, start: 1, end: 3, stroke: 0.75pt), [], [e], [f], [*group3*], table.cell(colspan: 2)[*value1*], table.hline(y: 5, stroke: 0.75pt) ), [d], [7], [8], table.hline(y: 6, stroke: 1pt) ) ``` -------------------------------- ### Create a Listing Table with Julia's SummaryTables.jl Source: https://github.com/pumasai/summarytables.jl/blob/master/README.md This example illustrates the use of the `listingtable` function to create a detailed listing table. It sets up a DataFrame with concentration, ID, dose, and time data, then uses `listingtable` to organize the data, summarizing rows by dose with length, mean, and standard deviation, and columns by time. ```julia data = DataFrame( concentration = [1.2, 4.5, 2.0, 1.5, 0.1, 1.8, 3.2, 1.8, 1.2, 0.2, 1.7, 4.2, 1.0, 0.9, 0.3, 1.7, 3.7, 1.2, 1.0, 0.2], id = repeat([1, 2, 3, 4], inner = 5), dose = repeat([100, 200], inner = 10), time = repeat([0, 0.5, 1, 2, 3], 4) ) listingtable( data, :concentration => "Concentration (ng/mL)", rows = [:dose => "Dose (mg)", :id => "ID"], cols = :time => "Time (hr)", summarize_rows = :dose => [ length => "N", mean => "Mean", std => "SD", ] ) ``` -------------------------------- ### HTML Link for DOCX Download Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/renderers.md This HTML snippet provides a download link for a generated DOCX file, `example.docx`, accompanied by a small image icon. It's designed for embedding direct download options within web pages. ```HTML ``` -------------------------------- ### Define a Complex Table Layout in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/summarytable/sort_false.typ.txt This snippet illustrates how to construct a detailed table using Typst's #table function. It includes examples of defining rows and columns, setting column gutters and alignment, applying strokes, and creating multi-level headers with cell spanning (colspan, rowspan). It also demonstrates using table.hline for horizontal rules and linebreak() for text formatting within cells. ```Typst #table( rows: 7, columns: 6, column-gutter: 0.25em, align: (left, left, left, center, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [], [], [], table.cell(colspan: 3)[*parameters*], table.hline(y: 1, start: 3, end: 6, stroke: 0.75pt), [], [], [], [T#sub[max]], [C#super[max]], [One Line #linebreak() Another Line], [*group2*], [*group*], [], table.cell(colspan: 3)[*value*], table.hline(y: 3, stroke: 0.75pt) ), table.cell(rowspan: 2)[1], [1], [*mean*], [1], [5], [9], [3], [*mean*], [3], [7], [11], table.cell(rowspan: 2)[2], [2], [*mean*], [2], [6], [10], [4], [*mean*], [4], [8], [12], table.hline(y: 7, stroke: 1pt) ) ``` -------------------------------- ### HTML Link for PDF Download Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/renderers.md This HTML snippet creates a clickable link to download a PDF file, `example.pdf`, and displays a small PDF icon next to it. It's typically used for embedding download options directly into web documentation. ```HTML ``` -------------------------------- ### Define a Multi-Row, Multi-Column Table with Custom Headers in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/summarytable/missing_groups.typ.txt This snippet illustrates the creation of a detailed table using Typst's `#table` function. It includes features such as defining rows and columns, setting column alignment and gutter, applying strokes, and creating complex headers with horizontal lines and merged cells. The example shows how to structure data and metadata within the table, including row and column labels and numerical values. ```Typst #table( rows: 6, columns: 5, column-gutter: 0.25em, align: (left, left, center, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [], [], table.cell(colspan: 3)[*B*], table.hline(y: 1, start: 2, end: 5, stroke: 0.75pt), [], [], [2], [4], [8], [*A*], [], table.cell(colspan: 3)[*value*], table.hline(y: 3, stroke: 0.75pt), ), ['a'], [*sum*], [], [6], [], ['b'], [*sum*], [4], [5], [], ['c'], [*sum*], [2], [1], [3], table.hline(y: 6, stroke: 1pt), ) ``` -------------------------------- ### Generate Dataset Overview Table Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/index.md Demonstrates `overview_table` for quickly glancing over the different columns making up a dataset. It uses a sample `diamonds` dataset from `RDatasets` to show a concise overview. ```julia using SummaryTables using RDatasets df = dataset("ggplot2", "diamonds")[!, 1:7] overview_table(df) ``` -------------------------------- ### Using DataFrame as Input for table_one in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md The `table_one` function is compatible with any object that adheres to the `Tables.jl` API. This example specifically demonstrates how to use a `DataFrame` as the input table for `table_one`. ```Julia using DataFrames using SummaryTables data = DataFrame(x = [1, 2, 3], y = ["4", "5", "6"]) table_one(data, [:x, :y]) ``` -------------------------------- ### Using NamedTuple of Vectors as Input for table_one in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md The `table_one` function supports various table types compatible with `Tables.jl`. This example shows how to provide a `NamedTuple` of `Vector`s as the input data for `table_one`. ```Julia using SummaryTables data = (; x = [1, 2, 3], y = ["4", "5", "6"]) table_one(data, [:x, :y]) ``` -------------------------------- ### Generate a Basic Table with Headers and Content in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/simple_table/three_cols_subheaders.typ.txt This snippet demonstrates how to create a structured table using Typst's #table function. It defines the table's dimensions (rows, columns), column alignment, and includes a custom header with nested sub-headers and horizontal lines. The table is populated with sample data, showcasing basic content arrangement. ```Typst #table( rows: 10, columns: 3, column-gutter: 0.25em, align: (center, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [*value1*], [*group3*], [*group1*], [_Sub1_], [_Sub2_], [_Sub3_], table.hline(y: 2, stroke: 0.75pt) ), [1], [c], [a], [2], [c], [a], [3], [d], [a], [4], [d], [a], [5], [c], [b], [6], [c], [b], [7], [d], [b], [8], [d], [b], table.hline(y: 10, stroke: 1pt) ) ``` -------------------------------- ### Define and Style a Basic Table in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/replace/replacemissing_default.typ.txt This snippet illustrates the creation of a simple table in Typst. It configures the table's dimensions (2x2), column gutter, and cell alignment. It also demonstrates adding horizontal lines at specific row indices and merging cells for custom content, such as a descriptive note. ```Typst #table( rows: 2, columns: 2, column-gutter: 0.25em, align: (center, center), stroke: none, table.hline(y: 0, stroke: 1pt), [-], [-], [1], [2], table.hline(y: 2, stroke: 1pt), table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ - No value ]], ) ``` -------------------------------- ### Demonstrate Group Splitting with Default Sorting Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/summarytable.md Provides an example of a summary table with nested groups, illustrating how default sorting correctly groups 'A' and 'B' entries even if they are interleaved in the source data. ```Julia using SummaryTables using DataFrames using Statistics data = DataFrame( value = 1:4, group1 = ["A", "B", "B", "A"], group2 = ["C", "D", "C", "D"], ) summarytable(data, :value, rows = [:group1, :group2], summary = [mean]) ``` -------------------------------- ### HTML Link for Typst PDF Download Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/renderers.md This HTML snippet provides a download link for a PDF file generated from Typst, `example_typst.pdf`, along with a small PDF icon. It's used to offer direct download capabilities on web pages. ```HTML ``` -------------------------------- ### Renaming Variables in table_one with Pair in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md This example shows how to rename a variable in the output table by passing a `String` in a `Pair` within the `analyses` argument. This allows for custom, more descriptive labels for your summarized variables. ```Julia using SummaryTables data = (; x = [1, 2, 3], y = ["a", "b", "a"]) table_one(data, [:x => "Variable X", :y]) ``` -------------------------------- ### Define a Basic Table Layout in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/global_rounding/auto_false_3.typ.txt This Typst code snippet demonstrates how to create a table with specified rows and columns, set column gutter, align content, and add horizontal lines. It also shows different ways to populate table cells, including multi-line content and content with separators. ```Typst #table( rows: 3, columns: 2, column-gutter: 0.25em, align: (center, center), stroke: none, table.hline(y: 0, stroke: 1pt), [1.41], [1.24e7], [1.06e8], [0.00111], [1.23 & 0.00123], [1.23 #linebreak() 0.00123], table.hline(y: 3, stroke: 1pt), ) ``` -------------------------------- ### Using Vector of NamedTuples as Input for table_one in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md Demonstrating `table_one`'s flexibility, this example illustrates how to use a `Vector` of `NamedTuple`s as the input table. This is another common data structure compatible with the `Tables.jl` API. ```Julia using SummaryTables data = [(; x = 1, y = "4"), (; x = 2, y = "5"), (; x = 3, y = "6")] table_one(data, [:x, :y]) ``` -------------------------------- ### Create a Basic LaTeX Table with Grouped Columns Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/listingtable/pagination_rows=1_1.latex.txt This LaTeX code snippet demonstrates how to define a simple table structure using the `tabular` environment within a `threeparttable`. It includes examples of `\multicolumn` for grouped column headers and `\cmidrule` for partial rules, enhancing readability and organization. The table uses `booktabs` for professional-looking rules. ```LaTeX \documentclass{article} \usepackage{threeparttable} \usepackage{multirow} \usepackage{booktabs} \usepackage{xcolor} \usepackage{tikz} \begin{document} \begin{table}[!ht] \setlength\tabcolsep{0pt} \centering \begin{threeparttable} \begin{tabular}{@{\extracolsep{2ex}}*{4}{llcc}} \toprule & & \multicolumn{2}{c}{\textbf{group3}} \\ \cmidrule{3-4} & & c & d \\ \textbf{group1} & \textbf{group2} & \multicolumn{2}{c}{\textbf{value1}} \\ \midrule a & e & 1 & 3 \\ \bottomrule \end{tabular} \end{threeparttable} \end{table} \end{document} ``` -------------------------------- ### Group Data with `groupby` in SummaryTables.jl Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md Demonstrates how to use the `groupby` keyword to group data by one or more columns. It shows examples of basic grouping, renaming a grouping column, and nesting multiple grouping columns for hierarchical analysis. ```Julia using SummaryTables data = (; x = [1, 2, 3, 4, 5, 6], y = ["a", "a", "a", "b", "b", "b"]) table_one(data, :x, groupby = :y) ``` ```Julia using SummaryTables data = (; x = [1, 2, 3, 4, 5, 6], y = ["a", "a", "a", "b", "b", "b"]) table_one(data, :x, groupby = :y => "Column Y") ``` ```Julia using SummaryTables data = (; x = [1, 2, 3, 4, 5, 6], y = ["a", "a", "b", "b", "c", "c"], z = ["d", "e", "d", "e", "d", "e"] ) table_one(data, :x, groupby = [:y, :z => "Column Z"]) ``` -------------------------------- ### Define a Basic Table in Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/global_rounding/auto_true_3.typ.txt This snippet illustrates how to construct a table in Typst. It uses the #table function to set up a 3x2 grid with specific column gutter, center alignment, and no default stroke. It also demonstrates adding horizontal lines at specific row indices and using '&' for column separation and '#linebreak()' for multi-line cell content. ```Typst #table( rows: 3, columns: 2, column-gutter: 0.25em, align: (center, center), stroke: none, table.hline(y: 0, stroke: 1pt), [1.41], [1.24e7], [1.06e8], [0.00111], [1.23 & 0.00123], [1.23 #linebreak() 0.00123], table.hline(y: 3, stroke: 1pt), ) ``` -------------------------------- ### Generate a Basic Table with Typst Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/row_and_column_gaps/singlecell.typ.txt This snippet demonstrates the use of Typst's #table function to create a 4x4 grid. It specifies the number of rows and columns, column gutter, cell alignment, and adds horizontal lines at the top and bottom of the table. Each cell is populated with its row and column index. ```Typst #table( rows: 4, columns: 4, column-gutter: 0.25em, align: (center, center, center, center), stroke: none, table.hline(y: 0, stroke: 1pt), [1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4], [3, 1], [3, 2], [3, 3], [3, 4], [4, 1], [4, 2], [4, 3], [4, 4], table.hline(y: 4, stroke: 1pt) ) ``` -------------------------------- ### Summarizing Demographic Data with table_one in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md This example demonstrates the basic usage of `table_one` to summarize several variables of a hypothetical population, split by sex. It shows how to define the data, specify variables for analysis, and apply grouping. ```Julia using SummaryTables using DataFrames data = DataFrame( sex = ["m", "m", "m", "m", "f", "f", "f", "f", "f", "f"], age = [27, 45, 34, 85, 55, 44, 24, 29, 37, 76], blood_type = ["A", "0", "B", "B", "B", "A", "0", "A", "A", "B"], smoker = [true, false, false, false, true, true, true, false, false, false], ) table_one( data, [:age => "Age (years)", :blood_type => "Blood type", :smoker => "Smoker"], groupby = :sex => "Sex", show_n = true ) ``` -------------------------------- ### Using Custom Labels with Concat and Superscript in table_one in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/table_one.md Labels in `table_one` can be any type except functions. This example demonstrates using `Concat` in conjunction with `Superscript` to create a more complex, non-string label for a variable, enhancing presentation flexibility. ```Julia using SummaryTables data = (; x = [1, 2, 3], y = ["a", "b", "a"]) table_one(data, [:x => Concat("X", Superscript("with superscript")), :y]) ``` -------------------------------- ### Display Basic Table with simple_table (Julia) Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/simple_table.md Demonstrates the basic usage of `simple_table` to display a `NamedTuple` of vectors, showing default column names and formatting. ```Julia using SummaryTables data = ( id = 1:5, name = ["Alice", "Bob", "Charlie", "David", "Eve"], age = [34, 29, 42, 37, 25], score = [88, 92, 75, 80, 95] ) simple_table(data) ``` -------------------------------- ### Define a Table with Headers and Data using Typst-like Syntax Source: https://github.com/pumasai/summarytables.jl/blob/master/test/references/simple_table/no_args.typ.txt This snippet demonstrates how to define a structured table with specified rows, columns, gutter, alignment, and custom headers. It includes horizontal lines for visual separation and populates the table with sample data. This syntax is common in document generation tools for creating tabular layouts. ```Typst #table( rows: 9, columns: 5, column-gutter: 0.25em, align: (center, center, center, center, center), stroke: none, table.header( table.hline(y: 0, stroke: 1pt), [*value1*], [*value2*], [*group1*], [*group3*], [*group2*], table.hline(y: 1, stroke: 0.75pt), ), [1], [a], [a], [c], [e], [2], [b], [a], [c], [f], [3], [c], [a], [d], [e], [4], [a], [a], [d], [f], [5], [b], [b], [c], [e], [6], [c], [b], [c], [f], [7], [a], [b], [d], [e], [8], [b], [b], [d], [f], table.hline(y: 9, stroke: 1pt), ) ``` -------------------------------- ### Rename Columns in simple_table Output (Julia) Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/table_functions/simple_table.md Illustrates how to rename columns in the `simple_table` output using a vector of `Pair`s, mapping original column symbols to new string names. This example re-defines `data` for self-containment. ```Julia using SummaryTables data = ( id = 1:5, name = ["Alice", "Bob", "Charlie", "David", "Eve"], age = [34, 29, 42, 37, 25], score = [88, 92, 75, 80, 95] ) simple_table(data, [:id => "Identifier", :name => "Full Name", :age => "Age (years)"]) ``` -------------------------------- ### Create a Basic Table with Cells in Julia Source: https://github.com/pumasai/summarytables.jl/blob/master/docs/src/reference/infrastructure/table.md Constructs a fundamental `Table` using an `AbstractMatrix` of `Cell` objects. This demonstrates the core method for populating table content in `SummaryTables`. ```Julia using SummaryTables cells = [Cell("$col$row") for row in 1:5, col in 'A':'E'] Table(cells) ```