Is it possible to adjust the width of columns when making tables with the kable() function in knitr?
A chunk like this for a table with two columns produces a table
My new favorite thing is the flextable
package because 1) the tables are beautiful, 2) you can more easily control things like width and font size, and 3) they render well to HTML and Word. Using your data:
```{r}
library(flextable)
library(magrittr)
df <- data.frame(x = 1:10, y = 11:20)
df %>% regulartable() %>% autofit() %>%
width(j=~x,width=1) %>% width(j=~y,width=1)
```
With both values of width
set to 1, the columns are close together:
If you adjust the last line to width(j=~x,width=2) %>% width(j=~y,width=2)
the table looks like this: