2

I know there are a few packages out there for customizing the look of the output tables for rmarkdown documents, like knitr and flextable. I'm considering using those, but I'm curious, if you don't use them, what determines the column width for dataframes in Rmarkdown documents? Is it different based on your type of output? If so, I'm most curious about HTML output.

I have some HTML output, and the column width seems very arbtirary, with some very large columns, and some smaller. What is causing these column widths to be set where they are? It doesn't seem to be the widest content within the column, nor the name of the column.

For example, in mine, column 5 looks much bigger than column 7, despite having values with fewer digits. And 8, 9, and 10 are far bigger than they need to be to display their values, and they have values similar to col 7 but are much wider. What is causing that?

Text

Sam Asin
  • 131
  • 9
  • That depends on multiple things. What options do you have for your output? What packages will you have associated with the RMD? What library will you use to render your table? These and more can cause appearances to differ. Your question is far too broad to answer effectively. To say what causes the widths here, you need to make it reproducible. This includes sample data like the output from `dput()` or `reprex::reprex()` and any libraries you are using, along with your RMD YAML output and options. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Aug 30 '22 at 01:48

0 Answers0