When generating an HTML file using knitr/pandoc to display multiple tables in a loop, how can you ensure that each table has the same total width despite having varying numbers of cells?
---
output:
html_document:
theme: cosmo
---
{r results ="asis", echo=FALSE, warning=FALSE, kable}
library(knitr)
library(markdown)
library(pander)
for (i in 1:12) {
df = data.frame(matrix(rnorm(i), nrow=2))
cat(pandoc.table(df, split.table = Inf))
}
I attempted to use CSS to set a fixed width for the tables by setting it to "auto" and aligning them left, but I was unsuccessful. Any suggestions on how to achieve this?