From e8d8decd374360fb0581ee7ba26e93fbabfc656e Mon Sep 17 00:00:00 2001 From: jgostick Date: Tue, 7 Nov 2023 21:58:53 +0900 Subject: [PATCH] Added tabset explaining creating subtables within a python computational block The R instructions call `kable` twice to produce the 2 tables, but in python calling `Markdown` twice does not work. Instead I found that `Markdown(table1 + table2)` seems to work, so I created a `tabset` with instructions for R and Python. --- docs/authoring/tables.qmd | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/authoring/tables.qmd b/docs/authoring/tables.qmd index 432c1cf813..dc43b61d6e 100644 --- a/docs/authoring/tables.qmd +++ b/docs/authoring/tables.qmd @@ -279,7 +279,10 @@ kable(head(cars)) If your code cell produces multiple tables, you can also specify subcaptions and layout using cell options: -```{{r}} +::: {.panel-tabset} +## R + +``` {.r} #| label: tbl-example #| tbl-cap: "Example" #| tbl-subcap: @@ -293,6 +296,22 @@ kable(head(cars)) kable(head(pressure)) ``` +## Python + +``` {.python} +#| label: tbl-example +#| tbl-cap: "Example" +#| tbl-subcap: +#| - "Cars" +#| - "Pressure" +#| layout-ncol: 2 +#| echo: fenced + +Markdown(cars + pressure) +``` + +::: + ## Grid Tables Grid tables are a more advanced type of markdown tables that allow arbitrary block elements (multiple paragraphs, code blocks, lists, etc.). For example: