Reputation: 453
I write almost all of my code in R Markdown documents and typically output to Word. I prefer to use the gt
package to generate summary tables.
I can get a given gt
object to output by using gtsave
as a .png
file. However, I can't change the size of the output with the code chunk settings ({r fig.dim = c()}
).
I know I can change the size of the saved table in my working directory by using the vwidht
/vheight
functions, but is there a way to also change the size of the outputted tables within the R Markdown, itself?
Upvotes: 2
Views: 3963
Reputation: 3242
The gt package has it's own table formatting functionality, I was able to use the below code to change the size of the outputted table within Rmarkdown itself. You will have to check the documentation for more details, by default, numeric numbers used in the arguments below are considered pixel width and height.
---
title: "Untitled"
author: "author"
date: "9/25/2021"
output: html_document
---
```{r cars}
library(gt)
gt(mtcars) %>% tab_options(., container.width = 500, container.height = 500)
```
Below, the container arguments set to 500x500
now, the container arguments are set to 100x100
Upvotes: 3