Side-by-side tables

tables
Author

Mine Çetinkaya-Rundel

Published

June 28, 2022

layout-ncol

Use the layout-ncol chunk option to organize output in columns, e.g., layout-ncol: 2 for two tables side-by-side.

```{r}
#| tbl-cap: Two tables
#| tbl-subcap: ["mtcars", "Just cars"]
#| layout-ncol: 2

library(knitr)

# table on the left
kable(head(mtcars[, 1:3]))

# table on the right
kable(head(cars))
```

Two tables

mtcars
mpg cyl disp
Mazda RX4 21.0 6 160
Mazda RX4 Wag 21.0 6 160
Datsun 710 22.8 4 108
Hornet 4 Drive 21.4 6 258
Hornet Sportabout 18.7 8 360
Valiant 18.1 6 225
Just cars
speed dist
4 2
4 10
7 4
7 22
8 16
9 10

Learn more

Options for tables produced by executable code cells