[SOLVED] Control output size of modelsummary or DT in bookdown

Issue

This Content is from Stack Overflow. Question asked by Marco

How can I control total size or width of elements like datasummary_skim from modelsummary package or datatable from DT package in bookdown? Those packages are great. But output is too large. I can zoom in and out via browser view, which looks perfectly fine. The commands themselves don’t come with these options. Perhaps there is a general html feature to control the size of a code chunk output?

---
title: "Output Size"
author: "Author"
date: "Today"
output: html_document
---

Test 

```{r cars}
library(DT)
datatable(mtcars)

library(modelsummary)
datasummary_skim(mtcars)
```

enter image description here



Solution

For a DT table, you can use the width option:

datatable(mtcars, width = "60%")


This Question was asked in StackOverflow by Marco and Answered by St├ęphane Laurent It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?