- "markdown": "---\ntitle: \"Side-by-side tables\"\ndate: \"2022-06-28\"\ncategories: [tables]\nimage: \"featured.png\"\nimage-alt: \"hello\"\n---\n\n\n## `layout-ncol`\n\nUse the `layout-ncol` chunk option to organize output in columns, e.g., `layout-ncol: 2` for two tables side-by-side.\n\n\n::: {.cell layout-ncol=\"2\" tbl-cap='Two tables' tbl-subcap='[\"mtcars\",\"Just cars\"]'}\n\n````{.cell-code}\n```{{r}}\n#| tbl-cap: Two tables\n#| tbl-subcap: [\"mtcars\", \"Just cars\"]\n#| layout-ncol: 2\n\nlibrary(knitr)\n\n# table on the left\nkable(head(mtcars[, 1:3]))\n\n# table on the right\nkable(head(cars))\n```\n````\n\n::: {.cell-output-display}\n| | mpg| cyl| disp|\n|:-----------------|----:|---:|----:|\n|Mazda RX4 | 21.0| 6| 160|\n|Mazda RX4 Wag | 21.0| 6| 160|\n|Datsun 710 | 22.8| 4| 108|\n|Hornet 4 Drive | 21.4| 6| 258|\n|Hornet Sportabout | 18.7| 8| 360|\n|Valiant | 18.1| 6| 225|\n\n\n\n| speed| dist|\n|-----:|----:|\n| 4| 2|\n| 4| 10|\n| 7| 4|\n| 7| 22|\n| 8| 16|\n| 9| 10|\n:::\n:::\n\n\n## Learn more\n\n[Options for tables produced by executable code cells](https://quarto.org/docs/authoring/tables.html#computations)\n\n",
0 commit comments